chris.george
chris.george

Reputation: 1

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?

Upvotes: 0

Views: 482

Answers (2)

zhang
zhang

Reputation: 375

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

Upvotes: 1

chris.george
chris.george

Reputation: 1

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.

Upvotes: 0

Related Questions