Skip to content

Commit 67f9ad8

Browse files
committed
Make dev container bind mount work from git worktrees
The dev container's docker-compose.yml mounted `../..` (the directory two levels above .devcontainer/) as `/workspaces`, relying on the repository being checked out into a directory literally named `oracle-enhanced` so that `workspaceFolder: /workspaces/oracle-enhanced` resolves. When the dev container is opened from a git worktree (e.g. `<repo>/.worktrees/<branch>/`), `../..` resolves to `.worktrees/` instead of a parent containing `oracle-enhanced/`. Docker then auto-creates an empty `/workspaces/oracle-enhanced` mount target on the host, so `postCreateCommand: bash .devcontainer/postCreateCommand.sh` fails with "No such file or directory". Mount the directory containing .devcontainer/ directly as `/workspaces/oracle-enhanced` so it does not depend on the host directory's name. This works from both the main checkout and any worktree.
1 parent 8849c0b commit 67f9ad8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

.devcontainer/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
context: .
55
dockerfile: Dockerfile
66
volumes:
7-
- ../..:/workspaces:cached
7+
- ..:/workspaces/oracle-enhanced:cached
88
command: sleep infinity
99
network_mode: service:oracle
1010

0 commit comments

Comments
 (0)