Search code examples
dockervisual-studio-codedocker-machine

Is it possible to mount docker container on VS code?


I saw it but I can't remember where I saw it.

It looked like seeing inside Linux, mounting the docker container on VS Code on Mac OS.

Is it possible to mount the docker container on VS code?


Solution

  • By "mount", I presume you're talking about opening VSCode inside the container instead of Docker volumes and bind mounts. You can install the Remote Containers extension to do this.

    Also see the docs mentioned by @AttilaViniczai for how to create development containers/dev contianers for VSCode: https://code.visualstudio.com/docs/remote/create-dev-container

    1. Install the VSCode extension

    remote containers extension

    1. Select the Remote Explorer tab on the left side of VSCode and make sure you have Containers selected from the drop down menu.

    select containers

    1. Double click the container you want to work on and/or right click and select Attach to Container. This will attach VSCode to that Docker container and install its required tools inside automatically.

    attach to container

    For more information about this, you can see the VSCode documentation here and a tutorial here.