-
First Download VS Code
-
Install following extensions
- Remote Developement
- Docker
- SSH Host
- Remote Container
- Remote Explorer
- After the installation is complete press
F1orCtrl + Pto open search tab and typeRemote-SSH: Connect to Host... - Click then add new host ip address where container is located. e.g. you want to connect to the hose machine have following details,
IP : 192.168.1.1
username : tom
then click + add host as follows ssh [email protected] Now the VS code will show the option for viewing the config file. You can open it and view it to check if everything is ok. If your port is 22 i.e., default then don't change anything but if you port is other than default 22 then add the variable in config file as follows and save it.
Port 1234
- Install Docker and WSL2 by follwoing instructions below,
- Now go to VS code press
F1orctrl + Pand search forPreferences: Open Settings (JSON)open this file and add follwoing line in that file.
"docker.host":"ssh://[email protected]"
Important The containers must be running on the host machine for you to attach them via VS code.
- first attach to remote host via normally
- then connect to remote container
this way you don't have to get
ssh-keygenfrom powershell and set it in the host machine.
-
Now press
F1orctrl + Pand search forRemote-Containers: Attach to Running Containerand you will see a list of running containers to select from -
Now first connect to host via
Remote-SSH : Connect to hostthen connect to the running containers in host machine.