13.2 Docker Continuous Delivery
A focused guide to Docker Continuous Delivery, connecting core concepts with practical Docker and container operations.
Docker continuous delivery extends continuous integration's automated build-and-test cycle through to actually deploying the resulting, validated container image, automatically (continuous deployment) or with a final manual approval gate (continuous delivery), turning a tested image into a running, deployed application.
The Distinction Between Continuous Delivery and Continuous Deployment
Continuous delivery automatically prepares a release-ready image but requires a deliberate, manual trigger for the actual production deployment; continuous deployment removes even that manual step, deploying automatically once all checks pass.
deploy-staging:
needs: push
steps:
- run: ./deploy.sh staging myapp:${{ github.sha }}
deploy-production:
needs: deploy-staging
environment: production
steps:
- run: ./deploy.sh production myapp:${{ github.sha }}
The environment: production configuration here can require a manual approval before this specific deployment step actually runs, reflecting a continuous delivery (rather than fully continuous deployment) approach.
Why Staging Deployment Typically Precedes Production
Deploying first to a staging environment, structurally similar to production but used specifically for final pre-production verification, provides an additional safety checkpoint before deploying to actual production traffic.
./deploy.sh staging myapp:${{ github.sha }}
curl https://staging.example.com/health
./deploy.sh production myapp:${{ github.sha }}
Pulling and Running the Validated Image in the Target Environment
The actual deployment step typically pulls the specific, already-built and validated image, rather than rebuilding it, ensuring the exact same image that passed every prior check is what's actually deployed.
ssh prod-server "docker pull myapp:${{ github.sha }} && docker compose up -d"
Why Docker Continuous Delivery Matters
Extending the automated pipeline all the way through to deployment, while maintaining appropriate safety checkpoints like staging verification and (for continuous delivery specifically) manual approval, closes the loop between a validated image and an actual running, deployed application.