Skip to content

Commit 6eabb7e

Browse files
committed
fix(api): mount host docker data for skiller
1 parent dc188e7 commit 6eabb7e

4 files changed

Lines changed: 28 additions & 10 deletions

File tree

docker-compose.api.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ services:
3535
- 1.1.1.1
3636
volumes:
3737
- docker_git_projects:${DOCKER_GIT_PROJECTS_ROOT:-/home/dev/.docker-git}
38-
- docker_git_docker_data:/var/lib/docker
38+
- /var/lib/docker:/var/lib/docker
3939
- /var/run/docker.sock:/var/run/docker.sock
4040
privileged: ${DOCKER_GIT_CONTROLLER_PRIVILEGED:-false}
4141
cgroup: host

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ services:
3535
- 1.1.1.1
3636
volumes:
3737
- docker_git_projects:${DOCKER_GIT_PROJECTS_ROOT:-/home/dev/.docker-git}
38-
- docker_git_docker_data:/var/lib/docker
38+
- /var/lib/docker:/var/lib/docker
3939
- /var/run/docker.sock:/var/run/docker.sock
4040
privileged: ${DOCKER_GIT_CONTROLLER_PRIVILEGED:-false}
4141
cgroup: host

packages/api/README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ This is now the intended controller plane:
1212
## Runtime contract: host-Docker-backed
1313

1414
`docker-git` is host-Docker-backed by default. The primary controller
15-
container created from this package binds the host socket
16-
(`/var/run/docker.sock:/var/run/docker.sock`, see `docker-compose.yml`) and
17-
uses it to spawn per-project containers. `DOCKER_GIT_DOCKER_RUNTIME=isolated`
18-
is an opt-in fallback for environments that explicitly require an embedded
19-
controller daemon. In isolated mode, start the controller through the host CLI
20-
or include `docker-compose.isolated.yml`; that overlay removes the host socket
21-
bind and defaults project containers to the embedded daemon endpoint
22-
`tcp://host.docker.internal:2375`.
15+
container created from this package binds the host socket and Docker data root
16+
(`/var/run/docker.sock:/var/run/docker.sock` and
17+
`/var/lib/docker:/var/lib/docker`, see `docker-compose.yml`) and uses them to
18+
spawn per-project containers and access the Docker volume paths reported by
19+
`docker inspect`. `DOCKER_GIT_DOCKER_RUNTIME=isolated` is an opt-in fallback for
20+
environments that explicitly require an embedded controller daemon. In isolated
21+
mode, start the controller through the host CLI or include
22+
`docker-compose.isolated.yml`; that overlay removes the host socket bind, keeps
23+
Docker data inside the controller volume, and defaults project containers to the
24+
embedded daemon endpoint `tcp://host.docker.internal:2375`.
2325

2426
Security note: binding `/var/run/docker.sock` gives the controller container
2527
root-equivalent control over the host Docker daemon, including the ability to

packages/app/tests/docker-git/controller-resource-limits.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import {
1818

1919
const composeFiles: ReadonlyArray<string> = ["docker-compose.yml", "docker-compose.api.yml"]
2020
const isolatedComposeFiles: ReadonlyArray<string> = ["docker-compose.isolated.yml", "docker-compose.api.isolated.yml"]
21+
const hostDockerDataBind = "/var/lib/docker:/var/lib/docker"
22+
const isolatedDockerDataVolume = "docker_git_docker_data:/var/lib/docker"
2123

2224
const readComposeFile = (relativePath: string): Effect.Effect<string> =>
2325
Effect.gen(function*(_) {
@@ -50,6 +52,13 @@ describe("controller compose resource limits", () => {
5052
const contents = yield* _(readComposeFile(composeFile))
5153
expect(contents).toMatch(/pids_limit: \$\{DOCKER_GIT_CONTROLLER_PIDS:-\d+\}/u)
5254
}))
55+
56+
it.effect("binds host Docker data root for host runtime volume path access", () =>
57+
Effect.gen(function*(_) {
58+
const contents = yield* _(readComposeFile(composeFile))
59+
expect(contents).toContain(`- ${hostDockerDataBind}`)
60+
expect(contents).not.toContain(`- ${isolatedDockerDataVolume}`)
61+
}))
5362
})
5463
}
5564

@@ -75,6 +84,13 @@ describe("controller compose resource limits", () => {
7584
const contents = yield* _(readComposeFile(composeFile))
7685
expect(contents).toContain("privileged: ${DOCKER_GIT_CONTROLLER_PRIVILEGED:-true}")
7786
}))
87+
88+
it.effect("keeps Docker data inside the embedded controller daemon volume", () =>
89+
Effect.gen(function*(_) {
90+
const contents = yield* _(readComposeFile(composeFile))
91+
expect(contents).toContain(`- ${isolatedDockerDataVolume}`)
92+
expect(contents).not.toContain(`- ${hostDockerDataBind}`)
93+
}))
7894
})
7995
}
8096
})

0 commit comments

Comments
 (0)