microsoft / microsoft/vscode-remote-release

Clone repository in container volume with Docker Compose fails due to permissions for non-existant folder

Open
#5,388 16 comments 6 reactions 1 assignee View on GitHub

@chrmarti is already working on this.

Since Jul 27, 2021.

bug containers plan-review
Dominant language
Dockerfile
Stars
4.2k
Forks
470
Avg merge
1d 1h
Merged PRs (30d)
1

Description

Version: 1.59.0-insider
Commit: e8a59bc6f920e731b47f0bc72263e82aba8b796e
Date: 2021-07-22T05:13:00.851Z
Electron: 13.1.7
Chrome: 91.0.4472.124
Node.js: 14.16.0
V8: 9.1.269.36-electron.0
OS: Darwin x64 20.5.0

Steps to Reproduce:

  1. On macOS, verify your local docker file share configuration does not include the /workspace folder.
    image
  2. Create a repository with a .devcontainer folder in it based on Docker Compose. e.g. pick Python 3 + Postgres from here: https://github.com/Chuxel/empty/tree/python-postgres
  3. In a new window in VS Code, run "Clone repository in container volume..." on the repository

Expected: Docker Compose-based dev containers start
Actual: Errors. What appears to be happening is the existing "workspace folder" mount point in the docker compose file is still there, but ends up using the path inside the container instead... which is not allowed by Docker so a permissions error appears.

Starting empty_devcontainer_app_1 ... error

ERROR: for empty_devcontainer_app_1  Cannot start service app: Mounts denied: 
The path /workspaces/empty is not shared from the host and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.
See https://docs.docker.com/docker-for-mac for more info.

ERROR: for app  Cannot start service app: Mounts denied: 
The path /workspaces/empty is not shared from the host and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.
See https://docs.docker.com/docker-for-mac for more info.
ERROR: Encountered errors while bringing up the project.
[7584 ms] Command failed: docker-compose --project-name empty_devcontainer -f /workspaces/empty/.devcontainer/docker-compose.yml -f /tmp/docker-compose.repositoryContainer.yml up -d

Earlier in the log file you can see this path in the output:

[6533 ms] services:
  app:
    build:
      args:
        INSTALL_NODE: "true"
        NODE_VERSION: lts/*
        USER_GID: '1000'
        USER_UID: '1000'
        VARIANT: '3'
      context: /workspaces/empty
      dockerfile: .devcontainer/Dockerfile
    command: sleep infinity
    labels:
      vsch.local.repository: https://github.com/chuxel/empty
      vsch.local.repository.folder: empty
      vsch.local.repository.volume: empty-2ac6de8b1d5867ef93cf7058ea7e0781
    network_mode: service:db
    volumes:
    - /workspaces/empty:/workspace:cached
    - empty-2ac6de8b1d5867ef93cf7058ea7e0781:/workspaces:rw
  db:
    environment:
      POSTGRES_DB: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_USER: postgres
    image: postgres:latest
    restart: unless-stopped
    volumes:
    - postgres-data:/var/lib/postgresql/data:rw
version: '3'
volumes:
  empty-2ac6de8b1d5867ef93cf7058ea7e0781:
    external: true
    name: empty-2ac6de8b1d5867ef93cf7058ea7e0781
  postgres-data: {}

In this case the docker-compose.yaml file includes the following:

    volumes:
      - ..:/workspace:cached

...which is required for the non-volume case.

If you add /workspace to your share config, it works even though the folder doesn't exist.

image

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.