Deploy Pre-Built Docker Image¶
Example: Deploying a pre-built Docker image to Airbase
This example demonstrates how to deploy an application using a pre-built Docker image, without building from source. This approach is useful when you have images from CI/CD pipelines, external registries, or want to quickly deploy a demo application.
What You'll Learn¶
- Pulling Docker images for deployment
- Deploying images to Airbase using CLI
- Deploying to different environments
- Verifying successful deployment
Prerequisites¶
Completed setup: - ✅ Signed up for Airbase account at console.airbase.tech.gov.sg - ✅ Created a team and project in Console - ✅ Installed Airbase CLI: sudo npm install --global @airbase/airbase-cli@containers - ✅ Logged in: airbase login - ✅ Docker installed and running
What you'll need: - Team handle (e.g., demo) - Project handle (e.g., demo-days) - Combined as: demo/demo-days
Step 1: Pull the Pre-Built Image¶
Pull the demo application image from the Airbase registry:
Why --platform linux/amd64? Airbase only supports AMD64 (x86_64) architecture. This flag ensures you pull the correct image, especially important on Apple Silicon (M1/M2/M3) Macs.
Expected output:
demo-days: Pulling from gdssingapore/airbase
Digest: sha256:e99fe672b29b1ee848ff162f6ae7303ace7c523ae6792f3e443f16d783b91eac
Status: Image is up to date for gdssingapore/airbase:demo-days
docker.io/gdssingapore/airbase:demo-days
Verify the image:
You should see:
Step 2: Deploy to Production¶
Deploy the image to your Airbase project:
Replace with your handles:
Interactive confirmation:
? Deploy gdssingapore/airbase:demo-days to days in default (production) (demo/demo-days:default) Yes
Type Yes and press Enter.
Deployment output:
Step 3: Verify Deployment¶
Open the URL in your browser:

Check deployment status:
Expected output:
Environment URL
----------- ----------------------------------------
production https://demo-days.app.tc1.airbase.sg
View application logs: - Open Airbase Console - Navigate to your project → Logs - Select production environment
Deploying to Staging¶
To deploy the same image to a staging environment:
Output:
? Deploy gdssingapore/airbase:demo-days to days in staging (demo/demo-days:staging) Yes
Deployed days in staging (demo/demo-days:staging)
Visit https://staging--demo-days.app.tc1.airbase.sg
Verify staging deployment:
Output:
Environment URL
----------- ------------------------------------------------
production https://demo-days.app.tc1.airbase.sg
staging https://staging--demo-days.app.tc1.airbase.sg
Deploying Custom Images¶
From Docker Hub¶
Example: Deploy nginx image:
# Pull image
docker pull --platform linux/amd64 nginx:alpine
# Tag for deployment (optional but recommended)
docker tag nginx:alpine my-nginx:v1
# Deploy
airbase container deploy --project myteam/mynginx --image my-nginx:v1
From Private Registry¶
Example: Deploy from AWS ECR:
-
Authenticate with ECR:
-
Pull image:
-
Tag for local deployment:
-
Deploy:
From GitLab Container Registry (SGTS)¶
Example: Deploy from SGTS GitLab:
- Authenticate:
- Username: Your GitLab username
-
Password: GitLab Personal Access Token
-
Pull image:
-
Tag locally:
-
Deploy:
Deploying with CI/CD¶
GitLab CI Example¶
Build in CI, deploy pre-built image:
stages:
- build
- deploy
build:
stage: build
script:
- docker build --platform linux/amd64 -t my-app:${CI_COMMIT_SHA} .
- docker tag my-app:${CI_COMMIT_SHA} my-app:latest
deploy:
stage: deploy
script:
- docker pull my-app:${CI_COMMIT_SHA}
- airbase container deploy --project myteam/myapp --image my-app:${CI_COMMIT_SHA} --yes
only:
- main
GitHub Actions Example¶
name: Deploy to Airbase
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build Docker image
run: docker build --platform linux/amd64 -t my-app:${{ github.sha }} .
- name: Deploy to Airbase
run: |
npm install -g @airbase/airbase-cli@containers
echo "${{ secrets.AIRBASE_RC }}" > ~/.airbaserc
airbase container deploy --project myteam/myapp --image my-app:${{ github.sha }} --yes
Advanced: Multi-Stage Deployment¶
Deploy to staging, test, then production:
# Deploy to staging
airbase container deploy --project demo/myapp --image myapp:v2.0 staging --yes
# Run tests against staging
curl https://staging--myapp.app.tc1.airbase.sg/health
# If tests pass, deploy to production
airbase container deploy --project demo/myapp --image myapp:v2.0 production --yes
Updating Deployments¶
Deploy a new version:
-
Pull new image:
-
Deploy update:
-
Verify update:
- Check logs in Airbase Console for production environment
- Verify new version is running
Airbase automatically: - Stops the old container - Starts the new container - Routes traffic to the new deployment - Typically takes 10-30 seconds
Troubleshooting¶
"Image not found" Error¶
Problem:
Solutions: 1. Verify image exists locally:
-
Pull the image again:
-
Check image name spelling (case-sensitive)
"Wrong platform" Warning¶
Problem:
WARNING: The requested image's platform (linux/arm64) does not match the detected host platform (linux/amd64)
Solution: Always use --platform linux/amd64 when pulling:
Or build with platform flag:
Application Not Accessible¶
Problem: URL returns 503 or 404
Solutions:
-
Check deployment status:
-
View logs for errors:
- Check logs in Airbase Console for production environment
-
Look for startup errors or crashes
-
Verify image runs locally:
-
Check if app binds to PORT:
- Ensure application reads
$PORTenvironment variable - Default port should be 3000
Permission Denied Errors¶
Problem: "permission denied" in container logs
Solution: Ensure your Dockerfile uses non-root user:
Custom images must use UID 999:
Key Takeaways¶
✅ Always use --platform linux/amd64 when pulling images for Airbase
✅ Use --project and --image flags to deploy pre-built images
✅ Deploy to staging first for testing before production
✅ Check logs immediately after deployment to catch issues early
✅ Images can come from any registry (Docker Hub, ECR, GitLab, etc.)
Next Steps¶
After deploying a pre-built image:
- Learn to build from source:
-
See: Build and Deploy
-
Explore starter templates:
-
See: Starter Templates
-
Set up CI/CD:
-
Customize your deployment:
- See: Environment Variables
- See: Manage Environments
See Also¶
- How-To: Build and Deploy - Build from source
- How-To: Manage Environments - Environment management
- Reference: CLI Commands - Full CLI reference
- Examples: Node.js Express - Build and deploy Node.js app