Rancher Docker container is unable to start due to dial tcp 127.0.0.1:6444: connect: connection refused

Audun Nes
2 min readAug 3, 2022

According to the Rancher 2.x documentation you can start Rancher as a Docker container using the following command:

sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 \
--privileged rancher/rancher

In my case this didn’t work, and I got the following error:

2022/08/03 11:00:07 [INFO] Rancher version v2.6.6 (9b2f2ae0e) is starting
2022/08/03 11:00:07 [INFO] Rancher arguments {ACMEDomains:[] AddLocal:true Embedded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:false Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit.log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Features: ClusterRegistry:}
2022/08/03 11:00:07 [INFO] Listening on /tmp/log.sock
2022/08/03 11:00:07 [INFO] Waiting for server to become available: Get "https://127.0.0.1:6444/version?timeout=15m0s": dial tcp 127.0.0.1:6444: connect: connection refused
2022/08/03 11:00:09 [INFO] Waiting for server to become available: Get "https://127.0.0.1:6444/version?timeout=15m0s": dial tcp 127.0.0.1:6444: connect: connection refused
2022/08/03 11:00:11 [INFO] Waiting for server to become available: Get "https://127.0.0.1:6444/version?timeout=15m0s": dial tcp 127.0.0.1:6444: connect: connection refused
2022/08/03 11:00:13 [INFO] Waiting for server to become available: Get "https://127.0.0.1:6444/version?timeout=15m0s": dial tcp 127.0.0.1:6444: connect: connection refused
2022/08/03 11:00:15 [INFO] Waiting for server to become available: Get "https://127.0.0.1:6444/version?timeout=15m0s": dial tcp 127.0.0.1:6444: connect: connection refused
2022/08/03 11:00:17 [INFO] Waiting for server to become available: Get "https://127.0.0.1:6444/version?timeout=15m0s": dial tcp 127.0.0.1:6444: connect: connection refused
2022/08/03 11:00:19 [FATAL] k3s exited with: exit status 1

I stumbled upon https://github.com/rancher/rancher/issues/36238 where other users had encountered this on various Linux distros, and had managed to get around the issue by either downgrading their Linux distros, or by changing the GRUB_CMDLINE_LINUX environment variable in their Grub configuration.

I am using macOS 12.5 on Apple Silicon with Docker Server version 20.10.17, and for me the workaround as to use Rancher to version 2.4.9 (instead of the latest and greatest) with the following command:

docker run -d --restart=unless-stopped -p 80:80 -p 443:443 \
--privileged rancher/rancher:v2.4.9

I have updated the GitHub issue with this information.

--

--

Audun Nes

Lead Cloud Engineer/Site Reliability Engineer from Copenhagen, Denmark. GitHub: https://github.com/avnes