I am trying to setup a development environment based on Visual Studio Code. The goal is to write and debug Python code that executes in a remote Docker container.
This is what I did: I installed Visual Studio Code Insiders, the Python extension, and the Remote Development extension (3 extensions in 1), setup SSH on both the remote computer (which runs Linux, and for which I am a sudoer) and mine (which runs Windows). So now I am able to connect to this remote computer via SSH and execute Python code on it. These features are already incredible but I need more.
On this remote machine there is a Docker service running, and I would like to be able to execute Python code with the Python interpreter inside some Docker container, not with the Python interpreter of the remote computer. So I downloaded the Docker extension not on my computer but on the remote computer (that was proposed by Visual Studio Code) and then changed the settings.json file to:
{
"remote.extensionKind": {
"peterjausovec.vscode-docker": "workspace"
}
}
according to what is stated here, section Docker Extension limitations. Then, after clicking on the Docker button on the left, I can see a list of all containers running on the remote computer, that's really great.
But when I try to attach Visual Studio Code to one of these containers, it fails to find the Docker daemon. After reading the documentation of the Docker daemon here, I restarted the Docker daemon with the option -H tcp://0.0.0.0:22
or -H tcp://0.0.0.0:2375
in order for the daemon to be able to listen to requests made remotely from my computer. The first one didn't work at all (the daemon didn't start), the second one works (the daemon starts). However, I still can't attach Visual Studio Code to my container (Visual Studio Code still can't find the daemon).
Any help would be greatly appreciated!