Skip to content

Latest commit

 

History

History
51 lines (45 loc) · 2.31 KB

VSCODE.md

File metadata and controls

51 lines (45 loc) · 2.31 KB

VSCode hints

Attaching to Docker run locally

  1. Install VSCode Docker extension.
  2. 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"

Attaching to Docker run remotely

  1. Install VSCode Docker extension.
  2. Shift-Command-P -> Preferences: Open Settings (JSON)
  3. Add "docker.host": "tcp://localhost:23750"
  4. 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.

  1. Forward the port, go to local VSCode client instance and look into Docker extension image

  2. If port 23750 is used, you should change it in VSCode settings and port forwarding setting to any other arbitrary unused port.

Default VSCode remote instance extensions

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",
],