Repository navigation
feat: run the dev stack under rootless Docker - #7309
Conversation
|
Claude finished @gustavosbarreto's task in 7m 5s —— View job Code Review CompleteReviewed 4 files and posted 2 inline issues. Standards: 0 violations, 0 judgement calls. Spec: did not run. Correctness: 2. StandardsNo violations. The diff adds no comments, the reasoning behind the workaround is in the commit message, and the new bats tests name the behaviour they cover. CorrectnessThe worst one is in SpecThe Spec axis did not run because the PR references no issue to review against. Additional notes
To request another review round, comment |
|
/review |
d64ad85 to
e66e34d
Compare
|
/review |
The server mounts the Docker socket for testcontainers. Under a rootless daemon that socket lives at $XDG_RUNTIME_DIR/docker.sock, so in development, when `docker info` reports rootless, the wrapper asks the CLI where the daemon is (DOCKER_HOST, else the active context) and hands the path to the dev overlay. Only then: Docker Desktop and Colima also report a unix:// endpoint under the user's home, but the daemon resolves bind-mount sources inside its VM, where only /var/run/docker.sock exists. The container side stays /var/run/docker.sock so nothing in the tests changes. TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE carries the host path because testcontainers passes it to the daemon when it bind-mounts the socket into Ryuk; the default there is /var/run/docker.sock again, which under rootless is the wrong daemon or nothing. Rootless cannot publish ports below net.ipv4.ip_unprivileged_port_start unless rootlesskit carries cap_net_bind_service. The dev defaults are 80 and 22, so in development the wrapper checks both and aborts with the setcap command instead of leaving Compose to fail on the bind. The 1024 fallback is the kernel default for that sysctl. sysctl and getcap sit in /usr/sbin on Debian, outside a user's PATH, so the wrapper adds the sbin directories when calling them; a getcap that is still missing (exit 127) turns the abort into a warning, since the wrapper then cannot tell. SHELLHUB_SSH_PORT may carry a bind address, 127.0.0.1:22, so the comparison strips everything up to the last colon.
|
/review |
e66e34d to
3f90d0d
Compare
Code Review CompleteThe automated review ran but did not post an updated summary — this usually means no new issues were found since the previous review. If you've pushed changes and want a fresh pass, comment |
Summary
The dev stack runs under a rootless Docker daemon. The wrapper finds the daemon's socket and mounts it into the
serverservice, which testcontainers uses to start the Postgres and Redis containers the suites need, and refuses to start when rootless cannot publish the configured ports.The container side stays
/var/run/docker.sock, so the tests do not change. The override is the host path testcontainers gives the daemon when it bind-mounts the socket into Ryuk.On the rootful daemon both values resolve to
/var/run/docker.sock, as before.Evidence
bats tests/compose/wrapper.bats, 15 ok. With the new scenarios added and no wrapper change, 5 fail: the three socket resolutions, the privileged-port abort, and the ssh-port abort.After:
bats tests/compose/, 39 ok../bin/docker-compose configon the rootful daemon renders the server mount from/var/run/docker.sockand the override with the same path.go test ./pkg/cache/ -run Redisinside the server container, recreated with the new environment, passes, so Ryuk still reaches the daemon through the override on rootful.name=rootlesssecurity option come from the testcontainers-go v0.44.0 source and the Docker API changelog, not from a run.Merge Danger
Door: two-way
Blast Radius: dev-only
docker-compose.dev.ymland the wrapper's development branch are the only changes. The production compose files are untouched, and the wrapper now runsdocker context inspecton every call anddocker infoon every development call, one daemon round trip more.