Share workspace path between runner and dind for job bind mounts
This commit is contained in:
1 parent
239a3b2057
commit
e769c3df3a
3 files changed
+56
-1
No files matched your search
@@ -251,6 +251,50 @@ Storage Driver: overlayfs
|
||||
|
||||
Cached images and builds in the old dind store are discarded by this reset.
|
||||
|
||||
## Workspace bind mounts inside jobs
|
||||
|
||||
A workflow step such as:
|
||||
|
||||
```bash
|
||||
docker run -v "$repo_dir:/app" ...
|
||||
```
|
||||
|
||||
fails if `$repo_dir` only exists in the job container. The Docker daemon doing the
|
||||
bind mount is dind, and it resolves the source path in **its own** filesystem.
|
||||
|
||||
The deployment prevents this by sharing a workspace volume at the same path in
|
||||
both containers:
|
||||
|
||||
```yaml
|
||||
volumes:
|
||||
ci-workspace:
|
||||
|
||||
services:
|
||||
dind:
|
||||
volumes:
|
||||
- ci-workspace:/workspace
|
||||
|
||||
runner:
|
||||
volumes:
|
||||
- ci-workspace:/workspace
|
||||
```
|
||||
|
||||
Runner config:
|
||||
|
||||
```yaml
|
||||
container:
|
||||
bind_workdir: true
|
||||
|
||||
host:
|
||||
workdir_parent: /workspace
|
||||
```
|
||||
|
||||
With this, the job workspace is under `/workspace/...` on the runner, the same
|
||||
path is visible to dind, and dind can bind that path into nested containers.
|
||||
|
||||
Without this shared path, use Docker named volumes or avoid bind mounts that
|
||||
refer to job-only paths.
|
||||
|
||||
## Networking details
|
||||
|
||||
- `dind` has no published Docker API port.
|
||||
|
||||
Reference in new issue
Block a user