microsoft / microsoft/vscode-remote-release

Volume mount does not resolve path correctly

Open
#11,696 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dockerfile
Stars
4.2k
Forks
469
Avg merge
1d 1h
Merged PRs (30d)
1

Description

  • VSCode Version: <fill in, e.g. 1.xx.x>
  • Local OS Version: Windows <version> / macOS <version> / Linux <version>
  • Remote OS Version: Linux container, e.g. Debian/Ubuntu/Oracle Linux
  • Remote Extension/Connection Type: Dev Containers
  • Logs:
database  | /opt/oracle/runUserScripts.sh: line 29: .: /opt/oracle/scripts/startup/create-schema-users.sh: is a directory

setup-apex-workspace  | >>> Verwende Script:
setup-apex-workspace  | total 8
setup-apex-workspace  | drwxr-xr-x 3 root root 4096 Jun 12 05:46 .
setup-apex-workspace  | drwxr-xr-x 1 root root 4096 Jun 12 05:46 ..
setup-apex-workspace  | drwxr-xr-x 2 root root   40 Jun 12 05:34 configure-apex-workspace.sh
setup-apex-workspace  | grep: /scripts/configure-apex-workspace.sh: Is a directory
setup-apex-workspace  | /scripts/configure-apex-workspace.sh: /scripts/configure-apex-workspace.sh: Is a directory

Steps to Reproduce:

  1. Open a repository in a VS Code Dev Container. The repository has the following structure:
/workspace
├── docker-compose.yml
├── scripts
│   ├── create-schema-users.sh
│   └── configure-apex-workspace.sh
└── src
  1. Use docker compose from inside the Dev Container to start additional services that bind-mount files from the workspace into other containers:
services:
  database:
    image: container-registry.oracle.com/database/free:latest
    volumes:
      - db_store:/opt/oracle/oradata
      - ./scripts/create-schema-users.sh:/opt/oracle/scripts/startup/create-schema-users.sh:ro

  setup-apex-workspace:
    image: oracletools/sqlplus:v19.18_lin
    volumes:
      - ./scripts/configure-apex-workspace.sh:/scripts/configure-apex-workspace.sh:ro
    command:
      - /bin/bash
      - -lc
      - /bin/bash /scripts/configure-apex-workspace.sh --required
  1. Run:
docker compose up
  1. Observe that the bind-mounted script paths are directories inside the target containers instead of files:
/opt/oracle/scripts/startup/create-schema-users.sh: is a directory
/scripts/configure-apex-workspace.sh: Is a directory

Expected behavior:

The file bind mounts should mount the workspace files as files inside the target containers:

/opt/oracle/scripts/startup/create-schema-users.sh
/scripts/configure-apex-workspace.sh

Actual behavior:

The target paths are created as directories inside the containers. This causes startup scripts to fail with is a directory.

Additional context:

The files exist inside the Dev Container:

test -f /workspace/scripts/create-schema-users.sh
test -f /workspace/scripts/configure-apex-workspace.sh

Both commands succeed in the Dev Container. However, when docker compose is executed from inside the Dev Container, sibling service containers do not receive the files correctly as bind mounts.

This looks related to workspace path handling in Dev Containers, especially when the workspace is mounted into the Dev Container in a way that is not visible as the same host path to the Docker daemon. It may be similar to issues where /workspace or ${containerWorkspaceFolder} exists inside the Dev Container but cannot be used reliably as a bind-mount source for other containers started by Docker Compose.

Workaround:

Copying the scripts into custom images with COPY works:

COPY scripts/create-schema-users.sh /opt/oracle/scripts/startup/create-schema-users.sh
COPY scripts/configure-apex-workspace.sh /scripts/configure-apex-workspace.sh

Mounting the whole directory may also work in some cases, but single-file bind mounts from the Dev Container workspace are unreliable in this setup.

Does this issue occur when you try this locally?: No

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the docker-compose.yml example and reproduce the single-file bind mounts from inside the Dev Container using the listed compose command. Investigate how workspace paths such as /workspace or ${containerWorkspaceFolder} are passed to the Docker daemon. Done means the two script paths appear as files in the target containers, while preserving the documented workaround behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, vscode
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.