[Bug]: ssh: connect to host host.docker.internal port 22
Description
Hello, I'm trying to solve this error on the Servers part of the web/ui
I keep getting this error
my ufw status shows port 22/tcp enabled with all of the requiered ports for coolify
Minimal Reproduction (if possible, example repository)
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | sudo bash
Exception or Error
Server is not reachable.
Please validate your configuration and connection.
Check this documentation for further help.
Error: ssh: connect to host host.docker.internal port 22: Connection refused
Version
v4.0.0-beta.323
Cloud?
- [ ] Yes
- [X] No
I had the same problem. Used UFW to allow SSH over my VPN IP. I fix it like this:
- Added a second rule to allow the server IP to port 22
- Restart the coolify docker image
After that, I was able to connect to the GUI and it connected to Localhost.
Since we have made a lot of changes to SSH and the validation process, I will close this issue. If this issue comes up again, feel free to reopen or create a new issue.
I am trying this out and just stumbled upon the same problem. Changing the rules with UFW worked.
I'm using version beta.379
I also have this issue
Same issue. i enable ufw. and used ufw-docker install.
Now my public address ip is protected (i can only connect with tailscale) but I have this error when trying to validate my server :
Error: ssh: connect to host host.docker.internal port 22: Operation timed out
I'm having the same issue:
Please validate your configuration and connection.
Check this documentation for further help.
Error: ssh: connect to host host.docker.internal port 22: Connection refused
Version v4.0.0-beta.390
I am facing the same issue
I am getting this error on a fresh coolify install when I am setting the Domain. I think it might be because I didn't install it as root
@rulrok Could you share how you fixed the issue with UFW? Thanks!
Also, check your sshd settings, if you have hardened your server, that might be interfering. For example I had these rules:
root@coolify-server:/data/coolify/source# cat /etc/ssh/sshd_config.d/custom.conf
Port 22
PermitRootLogin no
PasswordAuthentication no
X11Forwarding no
MaxAuthTries 3
AllowUsers johndoe
and both PermitRootLogin no and AllowUsers johndoe were interfering.
It worked after changing to:
root@coolify-server:/data/coolify/source# cat /etc/ssh/sshd_config.d/custom.conf
Port 22
PermitRootLogin yes
PasswordAuthentication no
X11Forwarding no
MaxAuthTries 3
AllowUsers johndoe root
I've checked my sshd settings, and I don't believe I have anything that would cause issues. This is mine for reference
Include /etc/ssh/sshd_config.d/*.conf
Port 22
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
KexAlgorithms [email protected],ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256
Ciphers [email protected],[email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr
MACs [email protected],[email protected],hmac-sha2-512,hmac-sha2-256,[email protected]
LogLevel VERBOSE
Subsystem sftp internal-sftp -f AUTHPRIV -l INFO
Protocol 2
X11Forwarding no
PermitEmptyPasswords no
IgnoreRhosts yes
HostbasedAuthentication no
UseDNS yes
ClientAliveCountMax 20
ClientAliveInterval 2000
LoginGraceTime 5
MaxAuthTries 2
MaxSessions 20
MaxStartups 10:30:50
PermitRootLogin yes
MaxAuthTries 4
PubkeyAuthentication yes
PasswordAuthentication no
KbdInteractiveAuthentication no
UsePAM yes
PrintMotd no
ClientAliveInterval 30
ClientAliveCountMax 50
AcceptEnv LANG LC_*
anyone could fix that please ?
I have fixed it this way:
- Found the Coolify container IP:
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' coolify
- Allowed SSH from that IP in UFW:
sudo ufw allow from <container_ip> to any port 22 proto tcp
-
Verified UFW status.
-
Confirmed Coolify’s SSH public key was in the host user’s
authorized_keys. -
Configured Coolify to use the correct SSH user and private key.
Now Coolify connects properly to the host via SSH inside Docker.
I have fixed it this way:
- Found the Coolify container IP:
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' coolify 2. Allowed SSH from that IP in UFW:
sudo ufw allow from <container_ip> to any port 22 proto tcp 3. Verified UFW status. 4. Confirmed Coolify’s SSH public key was in the host user’s
authorized_keys. 5. Configured Coolify to use the correct SSH user and private key.Now Coolify connects properly to the host via SSH inside Docker.
Thanks a lot bro, this works
I'm having this issue on a fresh ubuntu 22.04 install.
My port is slightly different, 3777, just to prevent random bots (it's not actually that btw).
However, I've updated ufw to account for this, and try changing the port in the onboarding to account for this as well.
ssh: connect to host host.docker.internal port 3777: Connection refused
(Same for 22, for what it's worth)
My sshd config:
Include /etc/ssh/sshd_config.d/*.conf
Port 3777
PermitRootLogin prohibit-password
PubkeyAuthentication yes
PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM yes
X11Forwarding yes
PrintMotd no
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
PasswordAuthentication no
I have the pubkey in /root/.ssh/authorized_keys
I have reset sshd after applying changes.
I have run sudo ufw allow from {docker ip} to any port 3777 proto tcp (and 22 fwiw)
Not sure what to try next. I can ssh in as root, as well as 2 other users I tested creating, from a terminal.
thanks all for feedback here - had the same issue, but it was intermittent - sometimes it was able to access the server via ssh and deploy things but then other times not. After switching from the default port (22) to another - the problem has gone (internet background noise interfering? im not sure)
I had a similar issue but I was deploying private repository with github app on a docker-compose.yml.
I'm using one server to deploy multiple applications.
I had to grant my internal docker container IP access to the port 22.
These are the commands I ran:
-
ufw status- This allowed me to verify that port 22 wasn't open to the whole world. My status for port 22 was LIMIT - Then I ran
ufw status verbose- I was able to verify that I had logging on. - Then I ran
tail -f /var/log/ufw.logand was able to find the internal IP that was attempting to access port 22 but was being blocked. Example: (10.0.0.4) - Lastly, I ran
sudo ufw allow proto tcp from 10.0.0.4 to any port 22