Skip to content

Proposal: Predefined variables for user's home directory #335

@AngellusMortis

Description

@AngellusMortis

We are running into a bunch of issues trying to support all of the use cases for devcontainers:

  • VS Code with bind mounts for source ("Reopen in container" after you open the source folder)
  • VS Code with code cloned into a container
  • Codespaces
  • PyCharm

The main hurdle we are hitting is the fact that Windows has a different env for the Home directory then Linux/Mac. If you are doing 1 or 3, it does not matter as much because for Windows you can do from within WSL first. Codespaces is always Linux.

I have seen some other people use both envs but that is still often resulting in a blank env that generates an error:

"mounts": [
        "source=${localEnv:HOME}${localEnv:USERPROFILE}/.docker,target=/home/app/.docker,type=bind,consistency=cached"
]

results in the following if I do "Clone Repository into Container Volume" straight from VS Code on Windows:

docker: Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /.docker.

Having a cross-platform and always defined way of providing the user's home directory on the host machine would help a ton.

(we are getting around the mount point not always existing with an initializeCommand)

"initializeCommand": {
    "mkdir-posix": "mkdir -p $HOME/.config $HOME/.docker $HOME/.cloudflared || true",
    "mkdir-windows": "mkdir %USERPROFILE/.config %USERPROFILE/.docker %USERPROFILE/.cloudflared || true"
},

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions