feat(deploy): enable Docker-in-Docker by default - #61
Merged
Conversation
Turn the Docker-in-Docker sidecar on by default so the deployed team can run its dockerized quality gate (task ci/lint/tests) out of the box. Flip the role default and the example inventory to enable_dind: true; hosts that cannot run a privileged container opt out by setting it to false.
With dind on by default the bot could start before the dind daemon accepted connections and fail its first task ci with "cannot connect to the Docker daemon". Add a healthcheck to the dind service (docker info probe) and, in the deploy template, make the bot depend_on dind with condition: service_healthy. Both the dind block and the bot's depends_on stay inside the enable_dind guard, so an enable_dind: false render yields a bot with no dind dependency. The local compose file gets the same healthcheck but no depends_on, since its dind service is profile-gated and a hard dependency would force the profile on a plain up.
Install docker-buildx-plugin alongside the existing docker CLI so image builds run through BuildKit instead of the deprecated legacy builder (removes the "legacy builder is deprecated" warning). Uses the Docker apt repo already configured in the same layer; no new source is added.
Update the DOCKER_HOST notes in both .env.example files and the README dind bullet: deploys now enable dind by default and the playbook injects DOCKER_HOST automatically, so the manual DOCKER_HOST line is only for local/custom setups.
The vk adapter has no Ansible deploy and bundles no dind compose profile, so the comment copied from the telegram adapter ("Ansible deploys enable dind by default" / "docker compose --profile dind") did not apply here. Describe vk's actual setup: the image ships the docker CLI + buildx, and DOCKER_HOST must point at a Docker daemon the operator provides.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The bot's quality gate runs entirely through Docker:
Taskfile.ymlsetsDEV_TOOLS: docker run --rm ... dev-toolsand every lint/test/vet/build target shells through it. In deploys the bot container ships the docker CLI but no daemon, sotask ci/lint/testsfail with "cannot connect to the Docker daemon". The privileged dind sidecar path already existed in the repo but was gated off byenable_dind: false. This turns it on by default (an isolated daemon — not the host socket), fixes the startup race, and adds buildx to the image.Changes per acceptance criterion
enable_dind: trueinroles/claude_tg_bot/defaults/main.ymland the example inventory; the comment documents the opt-out for hosts that cannot run a privileged container.healthcheck(docker inforeadiness probe) and the bot gainsdepends_on: { dind: { condition: service_healthy } }, both inside the{% if enable_dind %}guards in the deploy template. The localdocker-compose.ymlgets the same healthcheck but no botdepends_on(there dind is behindprofiles: ["dind"], so a hard dependency would force/break a normaldocker compose up).docker-buildx-pluginappended to the existing docker apt install line inadapters/telegram/Dockerfileandadapters/vk/Dockerfile(no new apt source; removes the "legacy builder deprecated" warning, enables BuildKit)..env.examplefiles andREADME.mdnote that deploys enable dind by default and the playbook injectsDOCKER_HOSTautomatically.How it was verified
The Docker-based
taskgate cannot run in the build environment (no daemon — the very thing this fixes; it is a host gate). Static verification performed:docker-compose.yml.j2forenable_dindtrue and false and validated each withdocker compose config: true → dind service + healthcheck + botdepends_on: service_healthy+dind_storagevolume; false → none of them (opt-out renders clean).docker-compose.ymlvalidated in default and--profile dindmodes: bot has nodepends_on,profiles: ["dind"]intact, healthcheck present.Pre-PR review
One critic round on the local diff → APPROVE, risk low (clean round, zero blockers/majors). Confirmed: guards correct on both branches,
docker infois a valid readiness probe fordocker:27-dindwith sane timings (10s/5s/5/30s), no host-socket exposure or isolation drop.Residual risks — needs a human eyeball
tcp://dind:2375.depends_on: service_healthyis honored bycompose up, not by the engine's restart policy after a reboot — the bot may start before dind is healthy again; relies on app-level retry toDOCKER_HOST.enable_dind: false.--profile dindsidecar (out of this PR's scope; sync in a follow-up if desired).