I have a local Ubuntu 20.04 server we can connect to over SSH, no problem. Following the docker-compose instructions here, the container seem to run with these settings in docker-compose.yml:
web:
image: 'gitlab/gitlab-ce:latest'
restart: always
hostname: 'gitlab'
environment:
GITLAB_OMNIBUS_CONFIG: |
# external_url 'http://192.168.0.142:8181'
# Add any other gitlab.rb configuration here, each on its own line
ports:
- '8181:8181'
# - '443:443'
# - '23:22'
volumes:
- '$GITLAB_HOME/gitlab/config:/etc/gitlab'
- '$GITLAB_HOME/gitlab/logs:/var/log/gitlab'
- '$GITLAB_HOME/gitlab/data:/var/opt/gitlab'
The server already has some web server running on port 80, hence the custom port. But trying to connect 192.168.0.142:8181 in the browser fails. What do I do wrong?
Thanks for quick reply The external_url is commented out, but I have also tried external_url '192.168.142:8181' and external_url '192.168.142' and external_url 'http://192.168.142:8181'with the same result.
I think I see it, the external address can be listening on 8181, but in the container, the gitlab workhorse listens on the default port, so in the containr port 8181 is not used.
You probably should use gitlab_workhorse[âlisten_addrâ] = â0.0.0.0:8181â or use the default port in your compose file:
ports:
I solved it. Here are the correct combinations of parameters, hopefully of assistance for someone else having port 80 busy doing something else than serving Gitlab.
First I set external_url 'http://192.168.0.142', no ports necessary as implied in docs.
Then set
ports:
- '8000:80'
where the point is that 8000 is the port to apply to the external URL, e.g. `192.168.0.142:8000â in the browser. Docker listens to port 80, and does not know about port 8000 or what you choose.
This worked, thanks to @bartj for pointing me in the right direction. I did try the workhorse setting in gitlab.rb but it turned out to not be necessary.
Last tip when connecting to Gitlab: wait until the Docker image status from docker ps shows healthy, that took one minute after restarting on my server.
My working docker-compose.yml:
web:
image: 'gitlab/gitlab-ce:latest'
restart: always
hostname: 'gitlab'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://192.168.0.142'
# Add any other gitlab.rb configuration here, each on its own line
ports:
- '8000:80'
# - '443:443'
# - '23:22'
volumes:
- '$GITLAB_HOME/gitlab/config:/etc/gitlab'
- '$GITLAB_HOME/gitlab/logs:/var/log/gitlab'
- '$GITLAB_HOME/gitlab/data:/var/opt/gitlab'