Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update Docker image when there is new image version?

Tags:

docker

I am currently running the official ghost Docker image, and use this image to build several containers.

If I want to update the my Docker image, I simply just use the command:

docker pull ghost
docker restart oldcontainer 

Does it work ?

like image 752
user824624 Avatar asked May 04 '15 18:05

user824624


2 Answers

No. Updating an image will not affect the images that were built from that image, and certainly not affect the already-running containers that were created from this image.

One possible workflow would be sth. like this:

  1. Pull new version of base image
  2. Build new version of your own image on top of the image
  3. Destroy and re-create your own containers from the newly-built image
like image 87
helmbert Avatar answered Sep 28 '22 05:09

helmbert


A docker restart does a docker stop (or docker kill if the stop times out), which puts a container in an exit status, followed by a docker start, which starts the same container.

The fact that the image might have changed isn't detected at all in that process.

Removing and doing a full docker run with all the right parameter would pick up on an image change. See "How to upgrade docker container after its image changed"

like image 33
VonC Avatar answered Sep 28 '22 06:09

VonC