Skip to content

A CI/CD pipeline with Docker

Select an icon to see what it is.

Step 5 of 6

Deploy: pull and recreate

The deploy step connects to the production host, 10.0.0.20, over SSH. It runs docker compose pull and then docker compose up -d with the new tag. dockerd on the host pulls registry.example.com/shop/web:3f9a1c2, and Compose recreates only the services whose image changed.

$ ssh [email protected] 'cd /srv/shop && TAG=3f9a1c2 docker compose pull && TAG=3f9a1c2 docker compose up -d'

On the production host

docker compose pull (the image reference uses the TAG variable)
docker compose up -d (recreates changed services only)