Skip to content

Gitlab-ce docker image behind Apache (virtual host)

Hello gitlab users,

I am trying to run gitlab-ce docker image within existing apache server (either via port 80 and/or 443).

I have used the docker-compose provided on the official gitlab pages (https://docs.gitlab.com/omnibus/docker/)

Here is the docker-compose

web:
  image: 'gitlab/gitlab-ce:latest'
  restart: always
  hostname: 'gitlab.mydomain.com'
  environment:
    GITLAB_OMNIBUS_CONFIG: |
      external_url 'https://gitlab.mydomain.com'
      gitlab_rails['gitlab_shell_ssh_port'] = 2224
  ports:
    - '9090:9090'
    - '2224:22'
  volumes:
    - '/srv/gitlab/config:/etc/gitlab'
    - '/srv/gitlab/logs:/var/log/gitlab'
    - '/srv/gitlab/data:/var/opt/gitlab'

the image is pulled and built successfully and it seems to start.

here is the docker ps output:

CONTAINER ID        IMAGE                     COMMAND             CREATED             STATUS              PORTS                                                 NAMES
5cce5d75d93c        gitlab/gitlab-ce:latest   "/assets/wrapper"   10 minutes ago      Up 10 minutes       80/tcp, 0.0.0.0:2224->22/tcp, 0.0.0.0:9090->443/tcp   dockerimages_web_1

What i am not sure about is to how properly setup apache virtual host configuration, so that incoming traffic is sent to proper container.

Thanks in advance.