How to Deploy from Container Images on DigitalOcean App Platform
Push your container image to a supported registry like DOCR, then create a new app in DigitalOcean App Platform selecting the Container image tab, specify registry/repository/tag, configure resources, and deploy. Use unique tags and linux/amd64 platform for compatibility. Troubleshoot pull failures with cache clears and health checks for reliable scaling.
Prerequisites
- DigitalOcean account with App Platform access
- Docker installed locally for building and testing images
- Container image ready in DOCR, Docker Hub, or GitHub Container Registry
- doctl CLI for terminal deployments (optional but recommended)
- Unique image tags (avoid 'latest')
Step-by-Step Instructions
Set Up Prerequisites and Authenticate
doctl authenticated via doctl auth init. Install Docker locally and verify your environment matches Linux/AMD64 by testing builds with docker build --platform=linux/amd64. Prepare credentials for private images in username:token format.[1][4]Create DigitalOcean Container Registry (DOCR)
doctl registry create my-registry --region nyc3 to create a registry if using DOCR (recommended for auto-deploy). Common defaults: 1 region, basic plan. Verify with doctl registry repository list.[1][4]Build and Push Image to Registry
docker build --platform=linux/amd64 --no-cache -t my-image:v1.0.0 . Tag for DOCR: docker tag my-image:v1.0.0 registry.digitalocean.com/my-registry/my-image:v1.0.0. Login via doctl registry login then push: docker push registry.digitalocean.com/my-registry/my-image:v1.0.0. Use unique tags like v1.0.0 instead of 'latest'.[1][4]Create App via Dashboard
my-registry/my-image) and tag/digest (e.g., v1.0.0). Add credentials for private images.[1][4]Configure App Resources and Settings
DATABASE_URL for databases.[1][4]Review Summary and Deploy
Deploy Using App Spec (app.yaml)
.do/app.yaml with services defining image: {registry_type: DOCR, registry: my-registry, repository: my-image, tag: v1.0.0}, http_port: 8080, instance settings, routes, and env vars. Use doctl apps create myapp --spec .do/app.yaml.[3]Update and Redeploy Image
docker build -t registry.digitalocean.com/my-registry/my-image:v2.0.0 . && docker push registry.digitalocean.com/my-registry/my-image:v2.0.0 Update app tag in dashboard or run doctl apps create-deployment YOUR_APP_ID to trigger redeploy.[1][3]Set Up Health Checks and Scaling
health_check: {http_path: /health, initial_delay_seconds: 10, period_seconds: 30} in app spec or dashboard. Scale via instance count/size slugs like basic-xs. Add managed databases with auto-injected DATABASE_URL.[3][7]Verify Deployment and Access App
Common Issues & Troubleshooting
Image pull fails: 'trying and failing to pull image' or no logs
Rebuild with docker build --platform=linux/amd64 --no-cache, use unique tags (not 'latest'), verify credentials, force cache clear, check DO status page.[1][2]
Stuck builds or vague errors
Contact support for stuck deploys, ensure Dockerfile COPY commands work on Linux/AMD64, clear platform caches.[1][2]
Health check failures
Verify HTTP port (8080 default), add /health endpoint, set initial_delay_seconds: 10, ensure app starts correctly.[3][7]
Database connectivity issues
Use managed DB with unrestricted connections, auto-injected DATABASE_URL env var.[7]
Architecture mismatch crashes
Always build/test with --platform=linux/amd64 locally before pushing.[1][2]