Developing with Docker#
To use Docker for developing in VS Code, you can use the Docker, Dev Containers and Remote Explorer extensions. Here’s a rough step-by-step guide:
- Build an image if it hasn’t been built already from VS Code
- Right click the image and select “Run interactive”
- Then in the running container, right-click and run “Attach VS Code”
- A new VS Code window will open and you can select a directory within the container to open You can also click the green icon in the lower left corner of the window to access the same options.
Developing on a Remote Server with SSH#
To connect to a remote server and run VS Code on it, use the same Remote Explorer extension along with Remote - SSH:
- Click the green icon in the lower lefthand corner of VS Code or use Remote Explorer and change the view to Remote.
- Your server list will be prepopulated by your SSH config file, but you can do a one-off connection or add a new saved connection.
- A new VS Code window will come up, and it will be connected to the server and allow you to open the remote directories (and terminals) in that window.
Source#
Docker development SSH Development