DockBridge is a CLI tool that enables users to run Docker on cheap Hetzner Cloud servers seamlessly. It acts as a transparent proxy, automatically provisioning cloud servers when Docker commands are run and destroying them when idle, while preserving state (images/volumes) via persistent block storage.
Problem Solved:
- Eliminates Docker Desktop resource overhead on Mac/Windows.
- Provides fast x86 builds on ARM Macs.
- Reduces cloud costs by only paying for compute when needed (servers destroy on idle).
- Language: Go (v1.24+)
- Cloud Provider: Hetzner Cloud (via
hetznercloud/hcloud-go) - Docker Interaction: Docker SDK (
docker/docker) - CLI Framework: Cobra (
spf13/cobra) - Configuration: Viper (
spf13/viper) - SSH:
golang.org/x/crypto/sshfor secure tunneling - Task Runner: Task (Taskfile)
- Local Client:
- Listens on a local Unix socket (default:
/tmp/dockbridge.sock). - Intercepts Docker API requests.
- Manages server lifecycle (Create, Start, Stop, Destroy).
- Establishes SSH tunnels to the remote server.
- Listens on a local Unix socket (default:
- Remote Server:
- Hetzner Cloud VPS (default: cpx21).
- Runs standard Docker Daemon.
- Mounts a persistent block volume at
/var/lib/dockerto persist state across server destructions. - Cloud-init is used for initial server setup.
- Communication:
- All traffic is tunnelled securely over SSH.
Task Runner: We use task (Taskfile.yaml) for all common operations.
- Build:
task build(output:bin/dockbridge) - Test:
task test(runsgo test ./...) - Lint:
task lint(runsgolangci-lint) - Security Check:
task security(runsgosecandgovulncheck) - All Checks:
task check(runs fmt, lint, security, and test) - Run this before committing! - Format:
task fmt
- Formatting: Standard
go fmt. - Linting: Strict
golangci-lintrules defined in.golangci.yml.- Enabled linters:
govet,staticcheck,unused,ineffassign,modernize.
- Enabled linters:
- Security:
gosecfor static analysis.govulncheckfor dependency vulnerability scanning.
- Error Handling: Use
github.com/pkg/errorsfor wrapping errors when context is needed, or standard modern Go error wrapping. - Testing: Use
github.com/stretchr/testifyfor assertions.
cmd/dockbridge: Main entry point.client: core logic for the local CLI.server: logic running on the remote server (if any custom agents are deployed).ssh-docker-proxy: Separate module for handling the SSH/Docker socket proxying logic.pkg: Reusable Go packages.
The project recently moved from an internal/ based structure to a root-level client/, server/, pkg/ structure. Code should be placed in these root directories, not internal.