简体   繁体   English

在external_url中使用任何部分都会导致服务器在docker和docker-machine上无法访问

[英]Using a any part in external_url causes the server to be unreachable on docker and docker-machine

An example of the commands being run: 正在运行的命令的示例:

docker run \
    --detach \
    --hostname gitlab.docker \
    --publish 8443:443 \
    --publish 8081:80 \
    --publish 2222:22 \
    --name gitlab \
    --restart always -v /var/run/docker.sock:/var/run/docker.sock \
    --volume /tmp/gitlab/config:/etc/gitlab \
    --volume /tmp/gitlab/logs:/var/log/gitlab \
    --volume /tmp/gitlab/data:/var/opt/gitlab \
    --env GITLAB_OMNIBUS_CONFIG="external_url 'http://gitlab.docker:8081/'; gitlab_rails['lfs_enabled'] = true;" \
    gitlab/gitlab-ce:latest

gitlab.rb gitlab.rb

external_url "http://gitlab.docker:8081"

access url: http://gitlab.docker:8081 访问URL: http://gitlab.docker:8081

Perhaps I'm missing something but when I remove the port I can access the interface on 8081, with it there it becomes inaccessible. 也许我丢失了一些东西,但是当我删除端口时,我可以访问8081上的接口,通过它可以访问该接口。

Any insights? 有什么见解吗?

You need set 'nginx-listen-port' to make the nginx inside the docker to listen to port 80, instead of the port 8081 specified by 'external_url'. 您需要设置'nginx-listen-port'来使docker内部的nginx监听端口80,而不是'external_url'指定的端口8081。 See: 看到:

https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md#setting-the-nginx-listen-port https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md#setting-the-nginx-listen-port

I figured it out, when you run: 当您运行时,我知道了:

gitlab-ctl reconfigure gitlab-ctl重新配置

The port in the external url gets parsed and placed into nginx config so the docker port you were forwarding is no longer valid. 外部url中的端口将被解析并放入nginx config中,因此您转发的docker端口不再有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM