Question

ssh: connect to host 64.227.117.45 port 22: Connection refused

Posted May 10, 2021 115 views
CentOSDocker

When I run “docker-compose up” on my HOST machine(mac os) i’m getting this error:

ssh: connect to host 64.227.117.45 port 22: Connection refused

My context is set correctly:
export DOCKER_HOST=ssh://ai-dev@64.227.117.45

Other commands, like “docker ps -a” or “docker run” works correctly with no errors..

ssh connection to the server works..

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi there,

Are you able to SSH to the 64.227.117.45 server?

It sounds like that you might either have a firewall enabled on the 64.227.117.45 host blocking the access to port 22, if this is the case you need to open port 22 or allow it for your IP address.

Another possible problem could be if the SSH service is not running on the 64.227.117.45 host, you can check that with the following command once you login to the server via the web console:

systemctl status sshd

Also, another thing that I could suggest is to cross-check if the IP is correct.

Let me know how it goes.
Regards,
Bobby

  • Hey Bobby - I’m having this same problem. My SSH is working otherwise and systemctl status sshd also shows that my SSH is working correctly. I can run normal docker run docker ps commands with SSH.

    The issue only occurs with SSH. When I run docker-compose --context remote up, I receive the following output in the terminal:

    Creating network "nginx-gohttp_default" with the default driver
    ssh: connect to host <ip address of droplet> port 22: Connection refused