Get a multi-container application running on Apple Container in 2 minutes.
- Apple Silicon Mac: Required for the native container runtime.
- macOS 26 (Tahoe): Recommended for the best experience.
- Apple Container: Installed and running.
container system start
- Container-Compose: Installed via Homebrew.
brew install container-compose
Create a new directory and a minimal compose.yaml file.
mkdir my-app && cd my-app
touch compose.yamlAdd the following content to compose.yaml:
services:
web:
image: nginx:alpine
ports:
- "8080:80"Launch your services in detached mode.
container-compose up -dCheck that your container is running.
container-compose psVerify the Nginx server is responding on the mapped port.
curl localhost:8080Stop and remove the containers when you are finished.
container-compose downCreate a .env file in the same directory as your compose file:
IMAGE_TAG=alpine
HOST_PORT=8080Reference the variables in compose.yaml:
services:
web:
image: nginx:${IMAGE_TAG}
ports:
- "${HOST_PORT}:80"Container-Compose loads ./.env by default. Pass a different file with --env-file:
container-compose --env-file ./config/prod.env up -dVerify substitution before starting:
container-compose configThis example starts a web service only after Redis passes its healthcheck.
services:
web:
image: nginx:alpine
ports:
- "8080:80"
depends_on:
redis:
condition: service_healthy
redis:
image: redis:7-alpine
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5Container-Compose enforces the ordering: redis must reach a healthy state before web starts. If redis has no healthcheck block, the condition falls back to service_started (running state). See Troubleshooting — depends_on with service_healthy if the wait does not behave as expected.
- Explore the CLI Reference for advanced flags.
- Check out Tutorials for complex architecture examples.
- Read Limitations and Gotchas before dropping in an existing stack.
- See Troubleshooting if something is not working.
| Command | Description |
|---|---|
up |
Create and start containers. |
down |
Stop and remove containers, networks, and images. |
ps |
List containers. |
logs |
View output from containers. |
build |
Build or rebuild services. |
exec |
Execute a command in a running container. |
run |
Run a one-off command on a service. |
watch |
Watch for file changes and update containers. |