Workflow
Run a published image
Use a published Docker image as the application source and let Dock pull and run the local container.
Overview
The published image workflow is ideal when you want to run an existing container from Docker Hub, GitHub Container Registry (GHCR), or a private registry without building from source.
1. Configure dock.yaml
Set application.image to the published image tag. Add ports if the container exposes web traffic and configure a healthcheck:
name: hello-nginx
docker:
enabled: true
application:
image: nginx:alpine
ports:
- host: 8080
container: 80
healthcheck:
type: http
path: /
port: 802. Lifecycle Walkthrough
Run through the standard Dock commands:
Step A: Validate
$ dock validate -c ./dock.yaml
✓ dock.yaml is validStep B: Plan (Action List) & Sync (State Comparison)
$ dock plan -c ./dock.yaml
Plan (hello-nginx):
- Pull published image: nginx:alpine
- Bind port: host 8080 -> container 80
- Health check: http GET / on port 80
$ dock sync -c ./dock.yaml
(Read-only state comparison: 0 installed, 1 image pending, 1 container pending)Step C: Init (Apply & Run)
$ dock init -c ./dock.yaml
✓ Pulling nginx:alpine...
✓ Creating container dock-hello-nginx...
✓ Container started
✓ HTTP health check passed on http://localhost:8080/Step D: Status & Logs
$ dock status --running -c ./dock.yaml
Project: hello-nginx
Containers (Running):
- dock-hello-nginx (Up 2m, Ports: 0.0.0.0:8080->80/tcp)Short-Lived Images Note
If you test with a short-lived image like hello-world:latest:
name: hello-world
docker:
enabled: true
application:
image: hello-world:latestThe container outputs its introductory message and terminates with exit code 0. When running dock status --stopped or inspecting with Docker, seeing Exited (0) is expected behavior because hello-world is not a persistent server daemon.