-
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
Remote - Containers configure multiple services in devcontainer.json #254
Comments
@kan We don't support this from a single VS Code window right now, but you can do this using multiple VS Code windows using the extension's "attach" functionality. Here's how:
Each Window should now be connected to a different container. You can also add |
@Chuxel thank you. I understand that I can attach to multiple containers in the way you indicate. In that case, for example, what will be the handling of the extension executed in the container? I would like to use the eslint extension in the container of node, but how should I describe the case of using vscode-go in the container of go in |
@kan There's two ways you can do this -- and there's also a way to do this without attaching and just opening a folder in a container twice. If you attach:
The other way is to use two FYI @chrmarti @egamma - Wonder if we should doc this. Here's a super simplified view of this alternate setup. Say you've got your folders setup like this:
Next, assume this is your version: '3'
services:
container-1:
image: ubuntu:bionic
volumes:
- ./container-1-src:/workspace
- ~/.gitconfig:/root/.gitconfig
command: sleep infinity
links:
- container-2
container-2:
image: ubuntu:bionic
volumes:
- ./container-2-src:/workspace
- ~/.gitconfig:/root/.gitconfig
command: sleep infinity Your {
"name": "Container 1",
"dockerComposeFile": ["../docker-compose.yml"],
"service": "container-1",
"workspaceFolder": "/workspace",
"extensions": ["ms-vscode.Go"],
"shutdownAction": "none"
} And {
"name": "Container 2",
"dockerComposeFile": ["../docker-compose.yml"],
"service": "container-2",
"workspaceFolder": "/workspace",
"extensions": ["dbaeumer.vscode-eslint"],
"shutdownAction": "none"
} To connect to both:
The Here's the test project: multi-container.zip |
@Chuxel Thank you for the explanation. I will try to find out how to prepare devcontainer.json for each container. |
@Chuxel Sounds good to me. Maybe we can have this as a separate page under 'advanced' topics. It will be good to collect more feedback from developers as we haven't used this setup ourselves much. |
👍 on documenting this as an advanced setup. |
I am developing using docker-compose with containers including go and node containers.
I would like to develop vscode attached separately to go container and node container respectively, but it seems that only one service can be specified in the current devcontainer.json specification.
Please let me know if there is a way to attach to multiple containers.
The text was updated successfully, but these errors were encountered: