Clarify Prometheus documentation when using GitLab with Docker

Hello,

I am interresting about the documentation of monitoring GitLab with Prometheus.

After reading this doc : https://docs.gitlab.com/ce/administration/monitoring/prometheus/#changing-the-port-prometheus-listens-on

I see that I would use http://localhost:9090 to access the Prometheus Dashboard that is bundled in GitLab-ce.

But it's not possible for me because I am using GitLab-ce with Docker and especially with Docker-compose.

I think this is because of Docker's networking, which makes the container's localhost distinct from the host's localhost.

URL that I used to test : http://gitlab.example.com:9090

I got the following error : ERR_CONNECTION_REFUSED

So, how can I reach the Prometheus instance from the docker host ?

I have exposed the port 9090 in my docker-compose.yml like this :

web:
  image: 'gitlab/gitlab-ce:latest'
  restart: always
  hostname: 'gitlab.example.com'
  environment:
    GITLAB_OMNIBUS_CONFIG: |
      external_url 'https://gitlab.example.com'
      # Add any other gitlab.rb configuration here, each on its own line
      gitlab_rails['gitlab_shell_ssh_port'] = 2224
  ports:
    - '80:80'
    - '443:443'
    - '2224:22'
    - '9090:9090'
  volumes:
    - '/srv/gitlab/config:/etc/gitlab'
    - '/srv/gitlab/logs:/var/log/gitlab'
    - '/srv/gitlab/data:/var/opt/gitlab'

Thank you very much for your help.

Best regards,

Assignee Loading
Time tracking Loading