How to use existing container in VSCode?
I have a file called .devcontainer.json. The path is /home/myname/Documents/ABC/.devcontainer.
{
"name": "Kaggle Dev CPU",
"image": "gcr.io/kaggle-images/python:v100",
"extensions": [
"ms-python.python",
],
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/opt/conda/bin/python"
},
"devPort": 8888,
"shutdownAction": "none"
}
It ran without any problem. I can access all python + other library that mimic kaggle environment. I also install some library in that container.
docker ps
>>
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bd7d3c11bedc gcr.io/kaggle-images/python:v100 "/bin/sh -c 'echo Co…" 10 months ago Up 49 minutes 8080/tcp affectionate_cray
Now, I want /home/myname/Documents/BCD/ ran from previous container. But how to do that?
What I have done and fails..
First attempt, Create .devcontainer.json in BCD/.devcontainer folder
{
"name": "Kaggle Dev CPU",
"container": "bd7d3c11bedc",
"extensions": [
"ms-python.python",
],
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/opt/conda/bin/python"
},
"devPort": 8888,
"shutdownAction": "none"
}
second attempt :
{
"workspaceFolder": "/home/myname/Documents/BCD",
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/opt/conda/bin/python"
},
"extensions": [
"ms-python.python",
],
"forwardPorts": 8889,
"remoteUser": "vscode",
"remoteEnv": { "MY_VARIABLE": "some-value" }
}
My reference, but I got confuse with that explanation
https://code.visualstudio.com/docs/remote/attach-container
https://code.visualstudio.com/docs/remote/create-dev-container