Configuring Dokploy for rolling updates and blue-green deployments so your users never see downtime.
Prerequisites
- Dokploy installed
- Application Dockerized
Step 1: Versioned Docker Images
Tag images with semver:
docker build -t myapp:1.0.0 .
Push to registry.
Step 2: Dokploy Config for Rolling Updates
dokploy.yaml:
apps:
myapp:
image: myregistry/myapp:${VERSION}
container_name: myapp
update:
type: rolling
max_unavailable: 1
delay: 10s
Set VERSION via env.
Step 3: Deploy Updated Version
export VERSION=1.0.1
git push dokploy main
Dokploy pulls new image, starts new container, stops old one after healthcheck.
Step 4: Healthchecks
Define healthcheck in Dockerfile:
HEALTHCHECK --interval=10s --timeout=5s --retries=3 \
CMD curl -f http://localhost:3000/health || exit 1
Ensures new container is healthy before replacing.
Step 5: Blue-Green Strategy
apps:
myapp-blue:
image: myregistry/myapp:${VERSION}
port: 3001
myapp-green:
image: myregistry/myapp:${VERSION}
port: 3002
myapp:
proxy:
to: myapp-${COLOR}
Switch COLOR env between blue and green.
Rolling updates for most cases, blue-green for critical switches. Healthchecks make both strategies reliable.