Update Docker containers via CLI

There are several ways to update Docker containers. You can use Portainer or Watchtower, but if you only have a few containers running, you can also do it via the CLI.

These steps assume that a (docker-)compose.yml file is in /docker directory and that the Docker Compose plugin is installed.

Login the Docker host

ssh user@host

Navigate to the directory

cd /docker/

Stop running containers

docker compose down

Update the containers

docker compose pull

Prune unused images

docker image prune

Confirm with Y and press Enter

Start the containers

docker compose up -d

Check running containers

docker ps