microsoft / microsoft/vscode-remote-release

If a devcontainer has a directory mapping VsCode uses the container's internal mapped directory as the identifier for the dev container instead of the project directory.

Open
#4,238 6 comments 0 reactions 1 assignee View on GitHub

@chrmarti is already working on this.

Since Jan 5, 2021.

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

Description

Issue Type: Bug

Usually VsCode identifies dev containers using the project directory name, if however a dev container has a directory mapping VsCode instead uses the container's internal mapped directory name as the identifier for the dev container. This is both inconsistent and extremely unhelpful.

Without any docker-compose.yml or directory mapping in place, the dev container is identified in VsCode (in the recent files list and elsewhere) as <project_directory_name> [Dev Container]. This is fine. For example.

Project directory layout 1

node1/
   .devcontainer.json

.devcontainer.json

{
   "image": "node:lts-alpine"
}

The dev container for this project is listed in the VsCode Recents list (CTRL+R) as node1 [Dev Container], where node1 is the name of directory containing the project.

Similarly

Project directory layout 2

node2/
   .devcontainer.json
   Dockerfile

.devcontainer.json

{
   "build": {
      "dockerfile": "Dockerfile"
   }
}

Dockerfile

FROM node:lts-alpine

Is listed as node2 [Dev Container].

However

Project directory layout 3

node3/
   .devcontainer.json
   docker-compose.yml

.devcontainer.json

{
   "dockerComposeFile": "./docker-compose.yml",
   "service": "node",
   "workspaceFolder": "/app"
}

docker-compose.yml

version: "3.8"
services:
node:
   image: node:lts-alpine
   tty: true
   stdin_open: true
   volumes:
      - ./:/app

The dev container for this project is instead identified in VsCode as app [Dev Container]. This is really unhelpful as it is common practise to use a single container internal directory e.g. /app in multiple projects, and there are a variety of reasons for this including:

  • Sharing configuration files between projects that are reliant on the container internal directory structure.
  • It's an unnecessary chore to devise directory names that are unique to a container.
  • It may not even be practical to try and ensure container directory names are unique in cases where a container ends up being widely reused.

The effect of this inconsistent dev container naming convention in the case where a directory mapping is used, is that when I open VsCode and press CTRL+R I see a list of dev containers all labelled app [Dev Container] making it impossible to directly open the one I want. Instead I have to first open the project directory as WSL and then reopen in its Dev Container in response to the pop up that appears which prompts you to do so.

I think VsCode should identify dev containers using the host directory name in all cases. The current implementation seems pointlessly inconvenient.

Extension version: 0.154.1
VS Code version: Code 1.52.1 (ea3859d4ba2f3e577a159bc91e3074c5d85c0523, 2020-12-16T16:34:46.910Z)
OS version: Windows_NT x64 10.0.18363
Remote OS version: Linux x64 4.19.128-microsoft-standard

System Info
Item Value
CPUs Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2808)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
protected_video_decode: enabled
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.86GB (4.55GB free)
Process Argv
Screen Reader no
VM 0%
Item Value
Remote WSL: Ubuntu-20.04
OS Linux x64 4.19.128-microsoft-standard
CPUs Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2807)
Memory (System) 12.37GB (9.29GB free)
VM 0%

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.