如何在 docker 上配置 gitlab-ce 域 url

How to configure gitlab-ce domain url on docker

我需要一些帮助来正确配置来自 gitlab/gitlab-ce:latest 的 gitlab docker 容器。

我有一个域nas.toto.eu,我已经在这个域上部署了 gitlab,端口为 8484

version: "3.7"
services:
  gitlab:
    image: 'gitlab/gitlab-ce:latest'
    container_name: gitlab
    restart: unless-stopped
    hostname: 'nas.toto.eu'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'http://nas.toto.eu'
        gitlab_rails['gitlab_shell_ssh_port'] = 2323
    ports:
      - '8484:80'
      - '8585:443'
      - '2323:22'
    volumes:
      - '/volume1/scripts/docker/gitlab/config:/etc/gitlab'
      - '/volume1/scripts/docker/gitlab/logs:/var/log/gitlab'
      - '/volume1/scripts/docker/gitlab/data:/var/opt/gitlab'
    networks:
      - gitlab

  gitlab-runner:
    image: gitlab/gitlab-runner:alpine
    container_name: gitlab-runner
    restart: unless-stopped
    depends_on:
      - gitlab
    volumes:
      - '/volume1/scripts/docker/gitlab/gitlab-runner:/etc/gitlab-runner'
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - gitlab

networks:
  gitlab:

它工作正常,我可以用我的域完美地克隆我的项目 http://nas.toto.eu:8484。 =D

当我尝试使用 gitlab-ci 时,gitlab 使用了错误的 url(此 url 上没有端口:/):

fatal: unable to access 'http://nas.toto.eu/extranet/frontend.git/': Empty reply from server

此项目存在于 http://nas.toto.eu:8484 而不是 http://nas.toto.eu。另外,当我用webIDE编辑.gitlab-ci.yml文件时,link返回项目也有错误url。

我在我的跑步者上找到 clone_url 选项来纠正 url 但连接超时。

[[runners]]
  name = "first runner"
  url = "http://172.24.0.2"
  clone_url = "http://172.24.0.2:8484"

但是我有同样的错误:

fatal: unable to access 'http://172.24.0.2:8484/extranet/backend.git/': Failed to connect to 172.24.0.2 port 8484: Operation timed out

如何纠正?是否有特殊的ci网络配置?

感谢您的回复!

找了很久很久,终于找到好的配置了。问题出在我的 gitlab-runner 中。事实上,如果 gitlab 可以从外部访问,并且如果我使用 url nas.toto.eu:8484 配置我的跑步者,它就可以工作:

[[runners]]
  name = "first runner"
  url = "http://nas.toto.eu:8484"
  clone_url = "http://nas.toto.eu:8484"

我不明白为什么会这样。 :(