Docker

Using Docker Compose locally, deploying to StackBlaze

6 min readUpdated April 2026

Docker Compose is great for local development. StackBlaze lets you take that same docker-compose.yml and import it directly, each service in the file becomes a standalone StackBlaze service with its own Git-connected build pipeline, private networking, and persistent storage.

You don’t have to rewrite your infrastructure description. The import command reads the Compose spec, maps service types intelligently, and presents you with a review screen before anything is provisioned.

Example, docker-compose.yml

docker-compose.yml

version: "3.9"

 

services:

  web:

    build: .

    ports: ["3000:3000"]

    environment:

      - DATABASE_URL=postgres://postgres:secret@postgres:5432/app

      - REDIS_URL=redis://redis:6379

    depends_on: [postgres, redis]

 

  postgres:

    image: postgres:16-alpine

    environment:

      POSTGRES_PASSWORD: secret

      POSTGRES_DB: app

    volumes:

      - pgdata:/var/lib/postgresql/data

 

  redis:

    image: redis:7-alpine

    volumes:

      - redisdata:/data

 

volumes:

  pgdata:

  redisdata:

Import command

terminal

$ stackblaze import compose

Parsed docker-compose.yml, 3 services found

web Web Service (Dockerfile, port 3000)

postgres PostgreSQL 16 (10 GB disk)

redis Redis 7 (1 GB memory)

Volumes pgdata, redisdata Persistent Disks (PVC)

✓ Ready to import. Run "stackblaze import compose --apply" to proceed.

Service type mapping

Compose keyStackBlaze service
build: .Web Service (Dockerfile)
image: postgres:16PostgreSQL Database
image: redis:7-alpineRedis Cache
volumes:Persistent Disk (PVC)
environment:Environment Variables / Secrets

Import flow

Compose file

docker-compose.yml

3 services

stackblaze import

CLI parses spec

maps → service types

Web Service

Dockerfile build

port 3000

PostgreSQL

Managed DB

PVC-backed

Redis

In-memory cache

persistent AOF

Under the hood

The Compose importer translates the declarative Compose spec into StackBlaze’s internal resource model, which then synthesises Kubernetes manifests for each service:

  • image / build: services with a build key become Web Services using your Dockerfile. Services with a known image (postgres, redis, mysql) map to managed StackBlaze databases.
  • volumes: named volumes become PersistentVolumeClaims sized at 10 GB by default. You can resize in the dashboard after import.
  • environment: plain string values become Kubernetes ConfigMap entries; values containing the word “secret”, “password”, or “token” are promoted to Secrets automatically.
  • networks: Compose’s default network is replaced by Kubernetes ClusterIP Services. Each service is reachable at its Compose service name as the hostname within the project namespace.

Step by step

01

Write your docker-compose.yml as usual

There's nothing special to add. Use the standard Compose spec you're already familiar with, define services, set build context or image, map ports, declare volumes, and wire services together with the depends_on key. StackBlaze understands Compose v3.x syntax.

02

Run stackblaze import compose

Install the StackBlaze CLI (npm i -g @stackblaze/cli) and run "stackblaze import compose" from the directory containing your docker-compose.yml. The CLI parses the file, resolves service dependencies, and sends the manifest to StackBlaze's API. You'll see a preview of each service that will be created.

03

Review imported services in the dashboard

Each Compose service appears as a separate StackBlaze service. The dashboard lets you review inferred settings, build command, exposed ports, environment variables, disk mounts, before any resource is provisioned. Edit anything before clicking "Deploy all".

04

Each service gets its own deployment pipeline

After confirmation, each service is connected to GitHub and gets an independent CI/CD pipeline. Pushing to main rebuilds only the services whose source files changed. Services communicate over StackBlaze's private network using their Compose service name as the hostname.