我是新来码头的。我使用以下命令运行gitlab ce容器:
docker run --detach --hostname localhost --publish 443:443 --publish 80:80 --name gitlab --restart always gitlab/gitlab-ce:latest这个容器工作得很好
我使用以下命令运行gitlab-runner容器:
docker run -d --name gitlab-runner --restart always gitlab/gitlab-runner:latest我的问题是,当我想注册gitlab-runner时,runner会问我:
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):我的回答是:http://localhost:80/,但它给了我错误:
ERROR: Registering runner... failed runner=K8trLPJx status=couldn't execute POST against http://localhost:80/api/v4/runners: Post http://localhost:80/api/v4/runners: dial tcp 127.0.0.1:80: connect: connection refused
PANIC: Failed to register this runner. Perhaps you are having network problems2个容器在我的pc上运行,带有windows 10
我不想在我的pc上本地运行gitlab-runner,我想让docker运行它
发布于 2020-08-02 03:14:11
问题是您缺少两个容器之间的网络。您可以手动创建,如下所示:
docker network create gitlab-network并且让你的容器使用这些命令加入它:
docker network connect gitlab-network gitlab
docker network connect gitlab-network gitlab-runner然后,您可以将其作为gitlab-ci协调器URL传递给gitlab,因为容器的名称是dns,容器在docker网络上是可以到达的。
另一种更优雅的解决方案是使用docker-compose来管理容器和网络。像这样的东西,我还没有测试过:
version: '3.3'
services:
gitlab:
image: gitlab/gitlab-ce:latest
networks:
- gitlab-network
ports:
- 80:80
- 443:443
gitlab-runner:
image: gitlab/gitlab-runner:latest
networks:
- gitlab-network
networks:
gitlab-network:https://stackoverflow.com/questions/61298991
复制相似问题