Warm tip: This article is reproduced from stackoverflow.com, please click
docker gitlab

Issues with gitlab while using docker

发布于 2020-04-13 09:47:18

I am trying to install docker gitlab image in my ubuntu 18.04 while following the link, so that I can use gitlab locally.

for this I ran the command

sudo docker run --detach \
--hostname gitlab.labs.com \
--publish 443:443 --publish 80:80 --publish 22:22 \
--name gitlab-labs \
--restart unless-stopped \
--volume /srv/gitlab/config:/etc/gitlab \
--volume /srv/gitlab/logs:/var/log/gitlab \
--volume /srv/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest

it first downloaded the image and then while starting it said the 443 is already in use. When I checked Ngnix is running on the port, so I have stopped that ngnix service. Later it gave me error 22 port is already inuse. so I killed the proccess on port 22 using kill command.

Finally I could make the docker running (checked --> docker ps)

Now I am trying to access http://gitlab.labs.com it says "Server Not Found".

when i checked the port connections

lsof -i:22
>COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
docker-pr 15736 root    4u  IPv4 148125      0t0  TCP ISL-D:ssh (LISTEN)
>lsof -i:443
docker-pr 15711 root    4u  IPv4 149948      0t0  TCP ISL-D:https (LISTEN)
>lsof -i:80    
docker-pr 15724 root    4u  IPv4 151075      0t0  TCP ISL-D:http (LISTEN)

even i tried with accessing my local ip 10.x.x.x the webpage says welcome to nginx.

any issue with the installation ? Or did I miss something ?

UPDATE:@Miq

After the changes things are like this

sudo docker run --detach \
  --hostname gitlab.labs.com \
  --env GITLAB_OMNIBUS_CONFIG="external_url 'http://gitlab.labs.com/'; gitlab_rails['lfs_enabled'] = true;" \
  --publish 10.10.60.7:443:443\
  --publish 10.10.60.7:80:80\
  --publish 10.10.60.7:22:22\
  --name gitlab-labs \
  --restart unless-stopped \
  --volume /srv/gitlab/config:/etc/gitlab \
  --volume /srv/gitlab/logs:/var/log/gitlab \
  --volume /srv/gitlab/data:/var/opt/gitlab \
  gitlab/gitlab-ce:latest
Questioner
Raady
Viewed
57
Miq 2020-02-04 00:28

You need to modify gitlab.rb because nginx has baked in DNS reverse proxy and it routes internally based on this parameter. The --hostname is just for docker, nginx cannot read from it.

Once you open /etc/gitlab/gitlab.rb make sure to set the external_url to point to a valid URL.