fix: Docker Compose fails inside session containers#177
Merged
Conversation
Session containers created via `coi shell` never called `enableDockerSupport()`, so Docker Compose failed with sysctl permission errors (net.ipv4.ip_unprivileged_port_start). Also changed `LaunchContainer`/`LaunchContainerPersistent` from `incus launch` + configure to `incus init` + configure + `incus start` to eliminate a race condition where security flags were set after boot. - Export `enableDockerSupport` as `EnableDockerSupport` - Add `EnableDockerSupport` call in session/setup.go before first boot - Fix LaunchContainer/LaunchContainerPersistent to use init+configure+start - Add Docker Compose integration test
The `docker compose ps --format json` output goes to stderr when piped through `coi container exec`, so check both streams.
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
security.nesting,security.syscalls.intercept.mknod,security.syscalls.intercept.setxattr) not being set on session containers created viacoi shellLaunchContainer/LaunchContainerPersistentto useincus init+ configure +incus startinstead ofincus launch+ configure, eliminating a race condition where security flags were set after bootenableDockerSupportasEnableDockerSupportso it can be called from the session setup pathRoot cause
The main session path (
session/setup.go) usedincus init+incus startbut never calledenableDockerSupport(). These flags only existed inLaunchContainer()/LaunchContainerPersistent()incommands.go, which are used bycoi container launchandcoi runbut not bycoi shell.Docker Compose fails with:
because the seccomp profile loaded at boot time doesn't include the required syscall interception rules.
Test plan
go build ./...passesgo vet ./...passestest_docker_flags_enabled,test_docker_works_in_container,test_docker_fails_without_nesting)test_docker_compose_works.py)ruff checkandruff format --checkpass on new test file