Skip to main content
HydroGo
DeploymentDocker

Docker

Run the published image, or the production Compose stack with Caddy, PostgreSQL and Redis.

Run the image

BASH
docker run -p 8080:8080 -e HYDRO_HTTP_ADDRESS=0.0.0.0:8080 -v "$PWD/config.yaml:/app/config.yaml:ro" -v hydro-data:/app/data ghcr.io/hydrohq/hydrogo:latest

Images are published to ghcr.io/hydrohq/hydrogo for linux/amd64 and arm64. Tags follow releases (v0.2.0) and latest; pre-release tags (with a hyphen, like v0.2.0-rc.1) never move latest. Pin a version in production.

Mount a project folder at /app (it holds config.yaml, content-types/ and data/), or just a config file at /app/config.yaml, and set HYDRO_HTTP_ADDRESS=0.0.0.0:8080 so Docker port forwarding can reach the container (the binary defaults to 127.0.0.1:8080):

BASH
docker run -d --name hydrogo -p 8080:8080 \
  -v "$(pwd)":/app \
  -e HYDRO_HTTP_ADDRESS=0.0.0.0:8080 \
  -e HYDRO_PUBLIC_ORIGIN=https://cms.example.com \
  ghcr.io/hydrohq/hydrogo:v0.2.0
The Dockerfile uses WORKDIR /app and runs as non-root user hydro. Always mount a persistent volume where your database.dsn and media.dir point.

Production Compose stack

deploy/docker-compose.prod.yml is a complete example: Caddy for TLS, HydroGo, PostgreSQL and Redis on a private network, with credentials supplied as Docker secrets. The entrypoint reads secret files and exports the matching HYDRO_* variables (database DSN, Redis URL, MFA key, S3 and SMTP credentials).

BASH
cd deploy
export HYDRO_PUBLIC_ORIGIN=https://cms.example.com
docker compose -f docker-compose.prod.yml up -d --build
docker compose -f docker-compose.prod.yml ps
  • The app container runs as a non-root user.
  • Its health check calls GET /readyz; Caddy waits for it before accepting traffic.
  • Run hydro migrate as an explicit operator step before starting a new version; runtime start-up does not apply schema changes on its own in this stack.
  • Because migrations are forward-only, rolling back an image tag only works if the database schema is backwards-compatible; otherwise restore a database snapshot/backup first.

Docker health check

The binary has a built-in probe usable in HEALTHCHECK lines without curl: hydro healthcheck requests http://127.0.0.1:8080/healthz (override with HYDRO_HEALTHCHECK_URL).

Dockerfile
HEALTHCHECK --interval=15s --timeout=4s CMD ["hydro", "healthcheck"]