how to have gitlab and gitlab-pages with custom domain in same docker container?

41 Views Asked by At

I use docker-compose for create my gitlab instance. It work.

I would like to have gitlab-pages in same container of my gitlab instance.

Here : https://docs.gitlab.com/ee/administration/pages/index.html#custom-domains

They say for to have a custom domain for gitlab-pages, I need a second IP.

How do to have that second IP when I use docker-compose ? Please

I've tried a few things :

Pour gitlab :

sudo docker network create --driver bridge \
    -o "com.docker.network.bridge.host_binding_ipv4"="172.20.0.2" \
    gitlab-network

Pour gitlab-pages :

sudo docker network create --driver bridge \
    -o "com.docker.network.bridge.host_binding_ipv4"="172.20.0.3" \
    gitlab-pages-network
volumes:
  gitlab_conf:
    name: gitlab-conf
    driver: local
    driver_opts:
      type: none
      o: bind
      device: /srv/gitlab/conf
  gitlab_log:
    name: gitlab-log
    driver: local
    driver_opts:
      type: none
      o: bind
      device: /srv/gitlab/log
  gitlab_data:
    name: gitlab-data
    driver: local
    driver_opts:
      type: none
      o: bind
      device: /srv/gitlab/data
  gitlab_runner_conf:
    name: gitlab-runner-conf
    driver: local
    driver_opts:
      type: none
      o: bind
      device: /srv/gitlab-runner/conf

networks:
  gitlab_network:
    name: gitlab-network
    external: true
  gitlab_pages_network:
    name: gitlab-pages-network
    external: true

services:
  gitlab:
    container_name: gitlab-container
    image: gitlab/gitlab-ce:latest
    restart: always
    volumes:
      - gitlab_conf:/etc/gitlab
      - gitlab_log:/var/log/gitlab
      - gitlab_data:/var/opt/gitlab
    networks:
      - gitlab_network
      - gitlab_pages_network
    ports:
      - 22:22
  gitlab_runner:
    container_name: gitlab-runner-container
    image: gitlab/gitlab-runner:latest
    restart: always
    volumes:
      - gitlab_runner_conf:/etc/gitlab-runner
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - gitlab_network

But it doesn't work

0

There are 0 best solutions below