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:

dock.yaml
name: hello-nginx

docker:
  enabled: true

application:
  image: nginx:alpine
  ports:
    - host: 8080
      container: 80
  healthcheck:
    type: http
    path: /
    port: 80

2. Lifecycle Walkthrough

Run through the standard Dock commands:

Step A: Validate

terminal
$ dock validate -c ./dock.yaml
✓ dock.yaml is valid

Step B: Plan (Action List) & Sync (State Comparison)

terminal
$ 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)

terminal
$ 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

terminal
$ 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:

dock.yaml
name: hello-world

docker:
  enabled: true

application:
  image: hello-world:latest

The 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.