Question
There is the following error on an attempt to connect to the Docker via SSH:
Cannot connect to the Docker daemon. Is the docker daemon running?
What actions could be taken to solve the problem?
Answer
There are different possible reasons for this error:
Make sure the SSH connection authentication type is correct
Connection to the remote Docker Engine doesn't support the Password type:
Switch to the Key pair or OpenSSH config... option.
Make sure the Docker daemon is indeed running on the remote host
Perform, for example, the following command to check if the Docker daemon is running:
ps aux | grep dockerd
If there is no Docker process, start it as described in this documentation page.
Make sure there are sufficient permissions for the docker command to be executed on the remote host
Log in to the remote host with the same credentials as set up in the SSH connection settings and try to perform the docker ps command.
If there are any permissions problems, check this guide in the official documentation.
Make sure the local Docker CLI is installed on your PC
Check How to connect to the remote Docker Engine for more details.
Make sure it is possible to access the remote Docker daemon from your local PC
Perform the docker --host ssh://<URL> ps command, where is the address of your remote host in the same format as you use it in the SSH connection.
For example, with the following SSH config
Host example
HostName 192.168.0.1
User test
IdentityFile /Users/test/.ssh/id_rsa
, the command should look like docker --host ssh://example ps.
Comments
0 comments
Please sign in to leave a comment.