- Install VSCode Docker extension.
Shift-Command-P
->Preferences: Open Settings (JSON)
- In Windows check "Settings -> General -> Expose daemon on tcp://localhost:2375 without TLS" and add
"docker.host": "tcp://localhost:2375"
into VSCode preferences - In Linux:
"docker.host": "/var/run/docker.sock"
- In Windows check "Settings -> General -> Expose daemon on tcp://localhost:2375 without TLS" and add
- Install VSCode Docker extension.
Shift-Command-P
->Preferences: Open Settings (JSON)
- Add
"docker.host": "tcp://localhost:23750"
- Forward the port using
ssh -N -L localhost:23750:/var/run/docker.sock <user>@<server>
- alternatively you can set port forwarding setting in the
~/.ssh/config
:
Host server-alias
Hostname server.ip.add.ress
User user_on_server
# create .key file with ssh-keygen
IdentityFile ~/.ssh/server.key
# Forward Jupyter, Tenorboard and SSH ports if needed.
# Local port localhost:9999 is forwarded to server's localhost:8888.
LocalForward 9999 127.0.0.1:8888 # you define remote ports (here 8888) on the docker_start.sh
LocalForward 9009 127.0.0.1:6006
LocalForward 2222 127.0.0.1:22
# Forward Docker host port to srever's docker host port.
LocalForward 23750 /var/run/docker.sock
When created, you will be able to connect to the sever with ssh server-alias
command.
-
Forward the port, go to local VSCode client instance and look into Docker extension
-
If port 23750 is used, you should change it in VSCode settings and port forwarding setting to any other arbitrary unused port.
If you have VSCode extesions to install in every container follow:
https://code.visualstudio.com/docs/remote/containers#_always-installed-extensions
My choice is:
"remote.containers.defaultExtensions": [
"eamodio.gitlens",
"mhutchie.git-graph",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-toolsai.jupyter",
"ms-toolsai.jupyter-keymap",
"ms-toolsai.jupyter-renderers",
"njpwerner.autodocstring",
],