Alternate docker port mappings in gitlab docker container cause http git clone failure in gitlab-ci

Trying to use alternate port mappings in gitlab docker container cause problems with gitlab-ci (gitlab-runner).

eg. docker run -d \ --hostname hostname \ --add-host=hostname:192.168.1.10 \ --publish 443:443 --publish 9000:80 --publish 2222:22 \ --name gitlab \ --restart always \ --volumes-from gitlabData \ gitlab/gitlab-ce:latest

This maps the main http port from 80 (internal to container) to 9000 (external port). This means that http git clone used by gitlab-runner must also use the 9000 port number. However the docker container thinks it is running on port 80, so the URL configuration in gitlab.rb, such as "external_url 'http://hostname'" must not refer to the 9000 port number otherwise the container port mapping fails and the main gitlab pages become unaccessible.

The URL "http://hostname/myrepo.git" without the container port mapping is passed to gitlab-runner so the clone from gitlab-ci fails.

gitlab needs a means of enabling alternate port mappings in docker containers.

Assignee Loading
Time tracking Loading