Dependencies to connect to a remote docker container in VSCode?
So, it appears that docker must be installed on the host
machine to prevent the last mentioned error.
Note: docker service does not need to be running in the host
(systemctl disable docker
)
With this in mind, these are the steps.
Host
:
- Install docker and ssh client
- Add your user to docker group
- Install VSCode
- Configure Server
- (After server config below): edit
~/.config/Code/User/settings.json
with
"docker.host":"tcp://localhost:23750",
- Configure your ssh keys for the
Server
- (After every reboot run on terminal:
ssh -N -L localhost:23750:/var/run/docker.sock <user>@<serveraddr>
) - Run VSCode and install
Remote Development
extension. Restart VSCode - Now you should see your running containers in VSCode
Remote explorer
>Containers
> Other Containers
Server
:
- Install docker and ssh server
- Install VSCode (this may not be a requirement on the server)
- Add your user to docker group and start your container