我已经安装了最新的GitLab社区版Docker镜像。环境为安装了Docker Community Edition的macOS (高塞拉)。
关于如何启动GitLab镜像,我遵循了下面的说明:https://docs.gitlab.com/omnibus/docker/
我没有在运行的容器中做任何修改(例如,没有更改gitlab.rb文件),只是从主机启动了镜像。
如果我使用默认端口,例如HTTP的端口为80,情况看起来工作得很好。
sudo docker run --detach \
--hostname gitlab.example.com \
--env GITLAB_OMNIBUS_CONFIG="external_url 'http://gitlab.example.com'; gitlab_rails['gitlab_shell_ssh_port'] = 22;" \
--publish 192.168.0.119:443:443 \
--publish 192.168.0.119:80:80 \
--publish 192.168.0.119:22:22 \
--name gitlab \
--restart always \
--volume /srv/gitlab/config:/etc/gitlab \
--volume /srv/gitlab/logs:/var/log/gitlab \
--volume /srv/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest我想在非标准端口上运行GitLab,例如HTTP的10080端口,因此将docker命令修改为:
sudo docker run --detach \
--hostname gitlab.example.com \
--env GITLAB_OMNIBUS_CONFIG="external_url 'http://gitlab.example.com:10080'; gitlab_rails['gitlab_shell_ssh_port'] = 22;" \
--publish 192.168.0.119:443:443 \
--publish 192.168.0.119:10080:80 \
--publish 192.168.0.119:22:22 \
--name gitlab \
--restart always \
--volume /srv/gitlab/config:/etc/gitlab \
--volume /srv/gitlab/logs:/var/log/gitlab \
--volume /srv/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest但是,当尝试使用网络浏览器或curl访问GitLab仪表板时,这会导致“来自服务器的空回复”,下面是curl运行:
$ curl -v http://192.168.0.119:10080
* Rebuilt URL to: http://192.168.0.119:10080/
* Trying 192.168.0.119...
* TCP_NODELAY set
* Connected to 192.168.0.119 (192.168.0.119) port 10080 (#0)
> GET / HTTP/1.1
> Host: 192.168.0.119:10080
> User-Agent: curl/7.58.0
> Accept: */*
>
* Empty reply from server
* Connection #0 to host 192.168.0.119 left intact
curl: (52) Empty reply from server我还可以运行lsof来验证GitLab停靠容器是否确实在侦听端口
$ lsof -nP -i4TCP:10080
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
com.docke 890 jo 19u IPv4 0x871834297e946edb 0t0 TCP 192.168.0.119:10080 (LISTEN)为了验证端口10080是否可用,我已经在它上面运行了其他侦听的应用程序,它们都像预期的那样工作。
有没有其他人遇到这种情况,或者有什么原因的建议,或者可以尝试的选择?!
干杯-jo
发布于 2021-05-04 06:32:29
不敢相信这个问题已经有3年没人回答了
更改:将'http://gitlab.example.com:10080'更改为'http://localhost:80'
该url需要反映内部端口,而不是映射的端口,并且它应该是实际的url。localhost可以工作。ip地址。不管你的主机名是什么都可以。
https://stackoverflow.com/questions/50061319
复制相似问题