从docker向gitlab注册gitlab runner
我是新来的码头工人。我使用以下命令运行gitlab ce容器:从docker向gitlab注册gitlab runner,docker,gitlab,gitlab-ci-runner,Docker,Gitlab,Gitlab Ci Runner,我是新来的码头工人。我使用以下命令运行gitlab ce容器: docker run --detach --hostname localhost --publish 443:443 --publish 80:80 --name gitlab --restart always gitlab/gitlab-ce:latest docker run -d --name gitlab-runner --restart always gitlab/gitlab-runner:latest 这个容器很好
docker run --detach --hostname localhost --publish 443:443 --publish 80:80 --name gitlab --restart always gitlab/gitlab-ce:latest
docker run -d --name gitlab-runner --restart always gitlab/gitlab-runner:latest
这个容器很好用
我使用以下命令运行gitlab runner容器:
docker run --detach --hostname localhost --publish 443:443 --publish 80:80 --name gitlab --restart always gitlab/gitlab-ce:latest
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/):
我的回答是:但它给了我错误:
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 problems
使用windows 10在我的pc上运行2个容器
我不想在我的电脑上本地运行gitlab runner,我想让docker运行它问题是两个容器之间缺少一个网络。您可以像这样手动创建它:
docker network create gitlab-network
并使用以下命令让容器连接它:
docker network connect gitlab-network gitlab
docker network connect gitlab-network gitlab-runner
然后您可以通过gitlab ci协调器URL传递,只需gitlab
,因为容器的名称是可以在docker网络上访问容器的dns
另一个更优雅的解决方案是使用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: