LikeC4 Docker
LikeC4 Docker image is a self-contained environment for running LikeC4 commands and can be used as a drop-in replacement for likec4 CLI.
It is hosted in GitHub Container Registry and Docker Hub and includes:
- Node.js (22.x)
- Graphviz (built from sources of the latest release)
- Playwright (latest)
- LikeC4 CLI (latest)
You can find the Dockerfile in the repository.
# Example: Help for export commanddocker run --rm -t likec4/likec4 export png -h# Example: Help for export commanddocker run --rm -t ghcr.io/likec4/likec4 export png -hTo work with the container you need to mount the folder with LikeC4 sources to /data directory
(it is the default working directory, but you can change it and use any other you prefer).
Start local web server
Section titled “Start local web server”# mount LikeC4 sources to /data: -v $(pwd):/data# publish ports: -p 5173:5173# (optional) use init process to correctly handle signals (eg Ctrl+C): --init# (optional) enable color output: -t# (optional) poll for file changes, see "Running the local web server on Windows" belowdocker run --rm \ -v $PWD:/data \ --init \ -t \ -p 5173:5173 \ -e CHOKIDAR_USEPOLLING=1 \ -e CHOKIDAR_INTERVAL=200 \ likec4/likec4 \ startLive updates (HMR) use the dev server port, so publishing 5173 is enough. If you need the HMR WebSocket on a separate port, set it with --hmr-port (or the HMR_PORT env var) and publish that port too:
docker run --rm \ -v $PWD:/data \ --init \ -t \ -p 5173:5173 \ -p 24700:24700 \ -e CHOKIDAR_USEPOLLING=1 \ -e CHOKIDAR_INTERVAL=200 \ likec4/likec4 \ start --hmr-port 24700# Or equivalently via env var:# -e HMR_PORT=24700Build static website
Section titled “Build static website”docker run -v $PWD:/data likec4/likec4 build -o distExport to PNG
Section titled “Export to PNG”docker run -v $PWD:/data likec4/likec4 export png --outdir assets --theme dark