Search code examples
dockerdocker-compose

Will a restarted docker compose service create a new container if the image has changed?


If a docker compose service stops for some reason, and is restarted automatically due to having a restart_policy, will it also re-create the container if:

  1. The docker image has changed? (For example if I'm using node:latest and have done docker pull node:latest and downloaded a newer image.)

  2. The docker image name has changed? (For example if I'm using an env var in the image name in docker-compose.yml, and the env var has changed.)

Or will it always just try to restart the existing docker container?


Solution

  • It will always just restart the existing docker container.