Running gitlab locally using docker

hi!

i am trying to run gitlab locally using docker. The documentation that i am following is GitLab Docker images | GitLab

I’ve tried to run gitlab through the command:

sudo docker run --detach \
  --hostname gitlab.example.com \
  --publish 443:443 --publish 80:80 --publish 22:22 \
  --name gitlab \
  --restart always \
  --volume $GITLAB_HOME/config:/etc/gitlab \
  --volume $GITLAB_HOME/logs:/var/log/gitlab \
  --volume $GITLAB_HOME/data:/var/opt/gitlab \
  --shm-size 256m \
  gitlab/gitlab-ee:latest

When i visit gitlab.example.com, i get ’ This site can’t be reached’

These are the last few lines i get from `docker logs gitlab’:

 - create new directory /var/opt/gitlab/grafana/provisioning/datasources[2022-06-23T23:58:35+00:00] INFO: directory[/var/opt/gitlab/grafana/provisioning/datasources] owner changed to 992

[2022-06-23T23:58:35+00:00] INFO: directory[/var/opt/gitlab/grafana/provisioning/datasources] mode changed to 700


    - change mode from '' to '0700'

    - change owner from '' to 'gitlab-prometheus'

  * directory[/var/opt/gitlab/grafana/provisioning/notifiers] action create[2022-06-23T23:58:35+00:00] INFO: directory[/var/opt/gitlab/grafana/provisioning/notifiers] created directory /var/opt/gitlab/grafana/provisioning/notifiers


    - create new directory /var/opt/gitlab/grafana/provisioning/notifiers[2022-06-23T23:58:35+00:00] INFO: directory[/var/opt/gitlab/grafana/provisioning/notifiers] owner changed to 992

[2022-06-23T23:58:35+00:00] INFO: directory[/var/opt/gitlab/grafana/provisioning/notifiers] mode changed to 700


    - change mode from '' to '0700'

    - change owner from '' to 'gitlab-prometheus'

  * file[/var/opt/gitlab/grafana/CVE_reset_status] action delete (up to date)

  * link[/var/opt/gitlab/grafana/conf] action create[2022-06-23T23:58:35+00:00] INFO: link[/var/opt/gitlab/grafana/conf] created


    - create symlink at /var/opt/gitlab/grafana/conf to /opt/gitlab/embedded/service/grafana/conf

  * link[/var/opt/gitlab/grafana/public] action create[2022-06-23T23:58:35+00:00] INFO: link[/var/opt/gitlab/grafana/public] created


    - create symlink at /var/opt/gitlab/grafana/public to /opt/gitlab/embedded/service/grafana/public

  * directory[/opt/gitlab/etc/grafana/env] action create[2022-06-23T23:58:35+00:00] INFO: directory[/opt/gitlab/etc/grafana/env] created directory /opt/gitlab/etc/grafana/env


    - create new directory /opt/gitlab/etc/grafana/env[2022-06-23T23:58:35+00:00] INFO: directory[/opt/gitlab/etc/grafana/env] owner changed to 992

[2022-06-23T23:58:35+00:00] INFO: directory[/opt/gitlab/etc/grafana/env] mode changed to 700


    - change mode from '' to '0700'

    - change owner from '' to 'gitlab-prometheus'

  * ruby_block[authorize Grafana with GitLab] action run[2022-06-23T23:58:35+00:00] 

WARN: Connecting to GitLab to generate new app_id and app_secret for GitLab Grafana.

Help would be well appreciated, thanks!

Hi

Is your container running and healthy? , you can check this with

sudo docker ps -a 

are you using a firewall? Are ports 443, 80 and 22 open?

hi,

thank you for getting back to me :slight_smile:

i re-ran it again today adding a gitlab.rb as follows

bash-3.2$ cat /etc/gitlab/gitlab.rb 
# Listen on all addresses
redis['bind'] = '0.0.0.0'
# Set the defaul port, must be set.
redis['port'] = 6379
# Set password, as in the secret `gitlab-redis` populated in Kubernetes
redis['password'] = 'REDIS_PASSWORD'

## Disable everything else
gitlab_rails['enable'] = false
sidekiq['enable'] = false
puma['enable']=false
registry['enable'] = false
gitaly['enable'] = false
gitlab_workhorse['enable'] = false
nginx['enable'] = false
prometheus_monitoring['enable'] = false
postgresql['enable'] = false
grafana['enable'] = false 

external_url "http://gitlab.example.com"

the logs i get now is

bash-3.2$ docker logs gitlab --tail 50

==> /var/log/gitlab/gitlab-exporter/current <==
2022-06-24_16:04:57.17071 127.0.0.1 - - [24/Jun/2022:16:04:55 UTC] "GET /ruby HTTP/1.1" 200 1010
2022-06-24_16:04:57.17241 - -> /ruby
2022-06-24_16:04:58.52282 127.0.0.1 - - [24/Jun/2022:16:04:30 UTC] "GET /database HTTP/1.1" 200 0
2022-06-24_16:04:58.52860 - -> /database
2022-06-24_16:05:00.05586 127.0.0.1 - - [24/Jun/2022:16:04:47 UTC] "GET /sidekiq HTTP/1.1" 200 106961
2022-06-24_16:05:00.07011 - -> /sidekiq

==> /var/log/gitlab/gitaly/current <==
{"level":"warning","msg":"[core] grpc: addrConn.createTransport failed to connect to {/var/opt/gitlab/gitaly/run/gitaly-348/sock.d/ruby.1 /var/opt/gitlab/gitaly/run/gitaly-348/sock.d/ruby.1 \u003cnil\u003e 0 \u003cnil\u003e}. Err: connection error: desc = \"transport: Error while dialing dial unix /var/opt/gitlab/gitaly/run/gitaly-348/sock.d/ruby.1: connect: no such file or directory\". Reconnecting...","pid":348,"system":"system","time":"2022-06-24T16:05:01.580Z"}
{"level":"warning","msg":"[core] grpc: addrConn.createTransport failed to connect to {/var/opt/gitlab/gitaly/run/gitaly-348/sock.d/ruby.0 /var/opt/gitlab/gitaly/run/gitaly-348/sock.d/ruby.0 \u003cnil\u003e 0 \u003cnil\u003e}. Err: connection error: desc = \"transport: Error while dialing dial unix /var/opt/gitlab/gitaly/run/gitaly-348/sock.d/ruby.0: connect: no such file or directory\". Reconnecting...","pid":348,"system":"system","time":"2022-06-24T16:05:01.580Z"}

==> /var/log/gitlab/puma/puma_stdout.log <==
{"timestamp":"2022-06-24T16:05:01.473Z","pid":873,"message":"PumaWorkerKiller: Consuming 1458.40625 mb with master and 2 workers."}

==> /var/log/gitlab/gitlab-rails/production.log <==
Started GET "/-/metrics" for 127.0.0.1 at 2022-06-24 16:05:03 +0000
Processing by MetricsController#index as HTML
Completed 200 OK in 945ms (Views: 6.4ms | ActiveRecord: 0.0ms | Elasticsearch: 0.0ms | Allocations: 673)

==> /var/log/gitlab/gitlab-rails/production_json.log <==
{"method":"GET","path":"/-/metrics","format":"html","controller":"MetricsController","action":"index","status":200,"time":"2022-06-24T16:05:05.135Z","params":[],"db_count":0,"db_write_count":0,"db_cached_count":0,"db_replica_count":0,"db_primary_count":0,"db_main_count":0,"db_main_replica_count":0,"db_replica_cached_count":0,"db_primary_cached_count":0,"db_main_cached_count":0,"db_main_replica_cached_count":0,"db_replica_wal_count":0,"db_primary_wal_count":0,"db_main_wal_count":0,"db_main_replica_wal_count":0,"db_replica_wal_cached_count":0,"db_primary_wal_cached_count":0,"db_main_wal_cached_count":0,"db_main_replica_wal_cached_count":0,"db_replica_duration_s":0.0,"db_primary_duration_s":0.0,"db_main_duration_s":0.0,"db_main_replica_duration_s":0.0,"cpu_s":0.193245,"mem_objects":1605,"mem_bytes":862816,"mem_mallocs":5015,"mem_total_bytes":927016,"pid":1625,"worker_id":"puma_0","rate_limiting_gates":[],"correlation_id":"f3b1673d-4bff-4b1f-9f14-06e5353a8b2b","db_duration_s":0.0,"view_duration_s":0.00644,"duration_s":0.997}

==> /var/log/gitlab/gitlab-exporter/current <==
2022-06-24_16:05:06.78291 127.0.0.1 - - [24/Jun/2022:16:05:05 UTC] "GET /ruby HTTP/1.1" 200 1005
2022-06-24_16:05:06.78562 - -> /ruby
2022-06-24_16:05:09.50070 127.0.0.1 - - [24/Jun/2022:16:04:48 UTC] "GET /database HTTP/1.1" 200 0
2022-06-24_16:05:09.52944 - -> /database

==> /var/log/gitlab/prometheus/current <==
2022-06-24_16:05:12.87446 level=warn ts=2022-06-24T16:05:12.637Z caller=manager.go:656 component="rule manager" group="GitLab Saturation Ratios" msg="Error on ingesting results from rule evaluation with different value but same timestamp" numDropped=1

==> /var/log/gitlab/postgresql/current <==
2022-06-24_16:05:14.01931 ERROR:  canceling statement due to statement timeout
2022-06-24_16:05:14.02313 STATEMENT:  SELECT relnamespace::regnamespace as schemaname,
2022-06-24_16:05:14.03564 	       relname as relname,
2022-06-24_16:05:14.04747 	       pg_total_relation_size(oid) bytes
2022-06-24_16:05:14.04883 	  FROM pg_class
2022-06-24_16:05:14.04999 	 WHERE relkind = 'r';
2022-06-24_16:05:14.05147 	

==> /var/log/gitlab/postgres-exporter/current <==
2022-06-24_16:05:18.06766 ts=2022-06-24T16:05:17.570Z caller=log.go:168 level=debug msg="Querying namespace" namespace=pg_long_running_transactions_marginalia

==> /var/log/gitlab/gitaly/current <==
{"level":"warning","msg":"[core] grpc: addrConn.createTransport failed to connect to {/var/opt/gitlab/gitaly/run/gitaly-348/sock.d/ruby.0 /var/opt/gitlab/gitaly/run/gitaly-348/sock.d/ruby.0 \u003cnil\u003e 0 \u003cnil\u003e}. Err: connection error: desc = \"transport: Error while dialing dial unix /var/opt/gitlab/gitaly/run/gitaly-348/sock.d/ruby.0: connect: no such file or directory\". Reconnecting...","pid":348,"system":"system","time":"2022-06-24T16:05:18.493Z"}

==> /var/log/gitlab/puma/puma_stderr.log <==
source=rack-timeout id=01G6B79XHVDKT41ANQM3WPCBRG timeout=60000ms service=62126ms state=timed_out at=error

the container is unhealthy:

bash-3.2$ docker ps
CONTAINER ID   IMAGE                     COMMAND             CREATED        STATUS                      PORTS                                                          NAMES
6ec0a1de57eb   gitlab/gitlab-ee:latest   "/assets/wrapper"   16 hours ago   Up 49 minutes (unhealthy)   0.0.0.0:22->22/tcp, 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   gitlab

how do i check if the ports are open? this is what i tried

bash-3.2$ netstat -vanp tcp
tcp46      0      0  *.80                   *.*                    LISTEN      131072 131072  35119      0 0x0100 0x00000006
tcp46      0      0  *.443                  *.*                    LISTEN      131072 131072  35119      0 0x0100 0x00000006
tcp46      0      0  *.22                   *.*                    LISTEN      131072 131072  35119      0 0x0100 0x00000006
bash-3.2$ docker port gitlab
22/tcp -> 0.0.0.0:22
443/tcp -> 0.0.0.0:443
80/tcp -> 0.0.0.0:80

I am not using a firewall.

let me know if you need additional info, thanks again for the help!