↑ ↓ select, Enter open, Esc close

Update Docker Compose images and recreate containers

Caution: This command changes the system. Understand what it does before you run it.

Adjust the values, the command updates live
root@server
docker compose -f /opt/app/compose.yaml pull && docker compose -f /opt/app/compose.yaml up -d

pull fetches the current image for the given tag of each service, then up -d recreates the affected containers and starts them in the background. Data in volumes is preserved, the affected services are briefly unavailable.

Note: With tags like latest, an update may bring a new major version, for example a database that needs a migration. Fixed version tags in the Compose file are safer. Remove old images afterwards with docker image prune.

Also searched as

  • docker compose update images
  • docker compose pull and up
  • update containers to latest image

Related one-liners

All in Docker

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.