Update Docker Containers In Docker Compose

  • Post category:Snippets

If the services used in a docker-compose.yml file have got updates and you want to update these on your deployed docker containers, then run the following commands.

Steps:

1] Go to the directory where the docker-compose.yml file is.

2] Pull the latest images for the services:

docker-compose pull
Bash

3] Recreate the containers with the latest images:

docker-compose up --force-recreate -d
Bash

This will ensure that the services are updated to their latest versions and restarted with the new images.