Skip to main content

Allow Remote Debugging of Docker Containers

When remotely debugging linux docker containers, the account that your remote debugging session uses to SSH into the Linux host must have RW access to the docker.sock process.

If the permission is not granted, you may see an error like this:

image.png

The above error means that (barring an SSH connection problem) the user account cannot communicate with the docker socket.

Granting permission to the remote debugger user can be done with either of the below ways:

Adding to the Docker Group

You can add the user to the docker permission group:

sudo usermod -aG docker $USER
Open Permissions for docker.sock

This method creates a security vulnerability that may give anyone on the system, access to docker resources or allow commands.
If adding your SSH user to the docker group fixes the problem, stop here.

The legacy method would be to open filesystem permissions on the docker.sock file like this:

sudo chmod 666 /var/run/docker.sock

Or, by changing permission on the symbolic link in /run, if your distro maps /var/run to /run with a symbolic link of the entire folder:

sudo chmod 1666 /run/docker.sock