简体   繁体   中英

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

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

access 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.

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'. See:

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

The port in the external url gets parsed and placed into nginx config so the docker port you were forwarding is no longer valid.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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