-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support ${workspaceFolder}
or ${hostWorkspaceFolder}
#442
Comments
We should maybe just tweak |
@chrmarti That could work - we should also support "workspaceMount": "src=${env:PWD}${env:CD},dst=/workspace,type=bind" We could also just override PWD for Windows, but that could lead to unintended consequences if that env is actually set for a different purpose (since it's not the standard for Windows). We've got the pattern for |
@Chuxel but if PWD was used for a different purpose in Windows, the above trick wouldn't work, right? You'll end up with that other thing prefixing your current path. So I think we really need the $workspaceFolder fix. |
I would remove the With the |
@zerdos
It was added post-release to handle these two common scenarios. Given you can have the mount land anywhere in the container, the Adding an additional volume mount is also quite important for scenarios like docker in docker among others. |
I just hit this too. I was spawning an RStudio server in a container, and I need to mount my folder at If there are possible workarounds in the meantime, I'd be interested to hear :-) |
I worked around this in 2 ways:
#!/bin/bash
eval DEV_CONTAINER_JSON='devcontainer.json'
INT_TESTS_TESTS_DIR=$(ls -d "${PWD}/../int-tests/tests")
sed -i.bak s~__INT_TESTS_TESTS_DIR__~"${INT_TESTS_TESTS_DIR}"~g "${DEV_CONTAINER_JSON}"
rm -f "${DEV_CONTAINER_JSON}.bak"
"runArgs": [
"--volume=/var/run/docker.sock:/var/run/docker.sock",
"--volume=${env:PWD}/int-tests/tests:/tests",
"--volume=${env:PWD}/app/build/libs/netfoip/shared:/usr/java/packages/lib"
] |
Having a |
I think I'm going to do something similar as temporary solution. I think I'll have |
No I think people with mono repos have valid use cases (mounting a subfolder). Also it's not only about mounting subfolders it's also about options such as |
I think I'm facing a similar issue but for different reasons. My project got mounted to /workspace/<project_name>. Since it's written in Go, it's necessary for it to be in $GOPATH/src. I've tried fiddling around with the config, and I just assumed |
yes that defeats the purpose of the whole thing. |
banging my head on another thing, if supporting |
Similarly to @Numline1 I'm having to manipulate the I need the code mounted into the I have tried to achieve this a number of other ways but none have worked as well as the hardcoding, I need the workspaceFolder set correctly within VS Code in order for Go to behave well both from the UI and the shell components. Obviously, hardcoding paths is not the best approach to sharing these setups. -- So I'd be happy if we could end up with either of the following 2 options:
Example 1 The workspace folder open in VS Code will be mounted into the container at {
"name": "kubernetes/release",
"dockerFile": "Dockerfile",
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt", "seccomp=unconfined"
],
"workspaceFolder": "/go/src/k8s.io/release",
"extensions": [
"ms-vscode.go"
],
"settings": {
"go.gopath": "/go"
}
} Example 2 The workspace folder open in VS Code (referenced by the {
"name": "kubernetes/release",
"dockerFile": "Dockerfile",
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt", "seccomp=unconfined"
],
"workspaceMount": "src=${workspaceFolder},dst=/go/src/k8s.io/release,type=bind,consistency=cached",
"workspaceFolder": "/go/src/k8s.io/release",
"extensions": [
"ms-vscode.go"
],
"settings": {
"go.gopath": "/go"
}
} |
@Chuxel |
Also, while environment variables do seem to work, command expansion as in: {
"runArgs": [
"-v", "$(realpath $PWD/../../)"
]
} doesn't seem to work. |
${workspaceFolder}
${workspaceFolder}
or ${hostWorkspaceFolder}
The current suggestion is to go with Command expansion is tracked as #1050. |
I agree that we need a different name but semantically this isn't about the |
Good point, although currently there is no way to mount the local folder, the mount will be on the machine where the Docker daemon runs on. What we are introducing is a variable for the folder where the With that in mind, maybe |
So, do we know where something like this is on the roadmap? |
A bit off topic, but Remote - SSH is effectively an amped up Nuclide (both use SSH to connect). There's also a guide on using a remote Docker host for containers. If there's something you're looking for that is not covered, please file a separate issue. |
Going with |
@chrmarti don't miss a chance to tap your inner journalist and leave me a contribline using the commit author annotations. GitHub email is listed on my profile. 😄 |
@chrmarti - so to confirm the new state based on my earlier Example 2. Would the proposed use of -- The workspace folder open in VS Code (referenced by the {
"name": "kubernetes/release",
"dockerFile": "Dockerfile",
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt", "seccomp=unconfined"
],
"workspaceMount": "src=${localWorkspaceFolder},dst=/go/src/k8s.io/release,type=bind,consistency=cached",
"workspaceFolder": "/go/src/k8s.io/release",
"extensions": [
"ms-vscode.go"
],
"settings": {
"go.gopath": "/go"
}
} |
@paulbouwer That is correct. |
Is |
@troshko111 Only |
@chrmarti I don't think this particular case is fixed yet. We'd realistically need to support
${workspaceFolder}
to get this to work. Unfortunately${env:PWD}
is going to be where VS Code starts, not the workspace location.This works:
This doesn't:
The remote case is supported, but this one requires an absolute path as things are now which really isn't workable - we could close in favor of #306, but it seems to bump up the priority of that one to me at least.
Originally posted by @Chuxel in #41 (comment)
The text was updated successfully, but these errors were encountered: