Running gitlab-docker on custom ports

docker

#1

Hi,

I’m trying to use the gitlab/gitlab-ce docker image on a remote server which has already other services running on the ports #: 22,443, 80

For this reason, I run the container using the instruction:

docker run --detach \
    --hostname gitlab.example.com \
    --publish 8929:80 \
    --publish 2289:22 \
    --name gitlab-test \ 
    --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
  • log in by running:
docker exec -it gitlab-test /bin/bash
  • Edit the file /etc/gitlab/gitlab.rb to:
external_url "http://gitlab.example.com:8929"
#external_url "https://gitlab.example.com:8929"
gitlab_rails['gitlab_shell_ssh_port'] = 2289
  • Stop the container

  • Commit the changes

docker commit -m "changed htttp and shh port to 8929 2289" -a "epifelix" a631f515edc7 gitlab/gitlab-ce:latest
  • Restart the container

But when I try to log into my server with a browser pointing to:

http://my.domain.ontheweb:8929

I got:

This site can’t be reached
my.domain.ontheweb refused to connect.

Try:
Checking the connection
Checking the proxy and the firewall

I tried on my server to issue:

ufw allow 8929
ufw allow 2289

But still unable to load the page.
Have you any advice on how to fix this?

Am I modifying the correct file /etc/gitlab/gitlab.rb , which logs should I look into?

Is there any port of the debian installer for ubuntu 17.04?

Thanks!


#2

First try for gitlab, wanna use docker to test and same problem.
No firewall for the first test.

any update after your try ?


#3

I got the same problem, but here’s what i did and now it’s working:

  1. changed /srv/gitlab/config/gitlab.rb:
    external_url "http://gitlab.example.com:8929" # set the address of gitlab
    nginx['listen_port'] = 8929                   # make nginx to listen on the sam port as confgured in external_url
    
  2. gitlab-ctl reconfigure # reconfigure gitlab ecosystem
  3. Run:
    docker run --detach \      
       --hostname gitlab.example.com \
       --publish 8929:8929 \                                    # map the port which is usted by nginx to the same port i would like to use finally
       --publish 2289:22 \
       --name gitlab-test \ 
       --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
    

hope it works for you as well.

Cheers,
SebaD


#4

i’ve found this was corrected in the documentation, but another issue roll back to the wrong doc !
i wrote in the issues at gitlab documentation … waiting