How to update PHP docker container with docker-compose

Saeid Raei
Nov 3 · 1 min read

lets say php has release a security patch and you want to apply that to your docker container. you can follow this instructions to update your php container without any downtime.

first of all you need to rebuild your php image(Note that there is no need to run the docker-compose down):

docker-compose build --no-cache --pull YOUR_PHP_CONTAINER_NAME_GOES_HERE

and then you need to bring up the new image:

docker-compose up -d

it will automatically brings only the newly create image.

I think this method can be applied on most of official images and not only on php.

if any improvements can be applied to this instructions let me know in the comments section.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade