当我尝试在端口 80 上运行 Gitlab docker 容器时,我很困惑为什么会收到错误“ERR_CONNECTION_REFUSED”,但如果我将端口号更改为 8000,它就完全可以工作。
我已经在互联网上搜索了四天来寻找答案,但我看到的唯一建议是容器缺少域名的 SSL 证书。但是,如果我将端口切换到 8000,容器就可以正常工作。任何人都可以将我从这种挫败感中解放出来,并解释为什么 8000 可以,而 80 不行吗?
不起作用的代码:
sudo podman run --detach \
--name gitlab-ce \
--hostname gitlab.example.com \
--publish 443:443 \
--publish 80:80 \
--publish 8022:22 \
--restart always \
--volume /srv/gitlab/config:/etc/gitlab:Z \
--volume /srv/gitlab/logs:/var/log/gitlab:Z \
--volume /srv/gitlab/data:/var/opt/gitlab:Z \
gitlab/gitlab-ce:latest
有效的代码:
sudo podman run --detach \
--name gitlab-ce \
--hostname gitlab.example.com \
--publish 443:443 \
--publish 8000:80 \
--publish 8022:22 \
--restart always \
--volume /srv/gitlab/config:/etc/gitlab:Z \
--volume /srv/gitlab/logs:/var/log/gitlab:Z \
--volume /srv/gitlab/data:/var/opt/gitlab:Z \
gitlab/gitlab-ce:latest
这是完全相同的代码,唯一的区别是一个端口号。
最佳答案
嗯,显然这个问题的答案是耐心。由于某种原因,在端口 8000 上时,服务器只需要大约 2 分钟即可做好准备。使用80端口时,需要10多分钟才能准备好。不太清楚为什么会这样,但它现在正在工作。太令人沮丧了。我把容器吹走了,因为它运行得不够快,然后又试了一次。
我发现这里的大多数问题都能以同样的方式得到回答。耐心等待。
关于docker - 在端口 80 上运行 Gitlab Docker 容器 ERR_CONNECTION_REFUSED,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66346869/