We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
前段时间在调研持续集成的框架,在本地部署过一套环境,在此记录一下
docker run -d \ --hostname gitlab.basebit.ai \ --publish 443:443 --publish 80:80 --publish 24:22 \ --name docker-gitlab \ --restart always \ --volume ~/workspace/docker/gitlab/config:/etc/gitlab \ --volume ~/workspace/docker/gitlab/logs:/var/log/gitlab \ --volume ~/workspace/docker/gitlab/data:/var/opt/gitlab \ gitlab/gitlab-ce:latest
# vi /etc/hosts # 加入指定自定义域名 127.0.0.1 gitlab.basebit.ai
ssh -T git@gitlab.basebit.ai
使用24端口具体碰到到问题参见:gitlab docker
docker run -d --name docker-gitlab-runner --restart always \ --link docker-gitlab:gitlab.basebit.ai \ -v ~/workspace/docker/gitlab-runner/config:/etc/gitlab-runner \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /usr/local/bin/docker:/usr/bin/docker \ gitlab/gitlab-runner:latest
注: linux和macOs的不同处
# linux -v /usr/bin/docker:/usr/bin/docker # macOs -v /usr/local/bin/docker:/usr/bin/docker
进入gitlab runner容器
docker exec -it docker-gitlab-runner /bin/bash
在容器内执行注册命令
sudo gitlab-runner register -n \ --url http://gitlab.basebit.ai/ \ --registration-token xxxxxxxxxxxxxx \ --executor docker \ --description "Runner Description" \ --docker-image "docker:latest" \ --docker-volumes /var/run/docker.sock:/var/run/docker.sock \ --docker-extra-hosts "gitlab.basebit.ai:172.17.0.2"
GitLab与Runners通过API进行通信, 所以只要Runners能访问网络就能与GitLab通信
由于使用的是本地域名,如果在注册runner中未设置过host,碰到连接失败问题参见如下 Gitlab-CI: Failed to connect to gitlab.basebit.ai port 80: Connection refused
样例参考: gitlab ci nodejs
The text was updated successfully, but these errors were encountered:
遇到问题 在runner中注册使用--executor docker,在gitlab构建时报错
bash fatal: unable to access 'http://gitlab.example.com:8929/root/test.git/': Failed to connect to gitlab.example.com port 8929: Connection refused ERROR: Job failed: exit code 1
就是git clone 找不到地址
注册
gitlab-runner register -n \ --url http://172.21.0.3:8929/ \ --registration-token xxxxxxxxxxxxxxxxx\ --executor docker \ --description "Runner Description" \ --docker-image "node:10.16.3-alpine" \ --docker-volumes /var/run/docker.sock:/var/run/docker.sock \ --docker-extra-hosts "gitlab.example.com:172.21.0.3"
我想应该是runner创建的docker容器是否访问不到172.21.0.3
请问有什么解决办法吗?谢谢
Sorry, something went wrong.
@pointline 需要增加一个 docker 的 host 映射,不过我看你配置里是加过的,问题应该出在 --url 上,你将 value 调整成 gitlab.example.com 试下看
@lqshow 感谢
gitlab-runner register -n \ --url http://gitlab.example.com:8929/ \ --registration-token dFaZ-PdbPX_xBybUkjq4 \ --executor docker \ --description "Runner Description" \ --docker-image "node:10.16.3-alpine" \ --docker-volumes /var/run/docker.sock:/var/run/docker.sock \ --docker-extra-hosts "gitlab.example.com:172.21.0.3" \ --docker-network-mode gitlab_gitlab-network
我查到到问题,发现在runner过程中创建的新的container是独立,没有建立在与gitlab和gitlab-runner同一网络。所以导致clone是无法访问,需要这个新container指定--docker-network-mode同一网络就可访问了
--docker-network-mode
No branches or pull requests
背景
前段时间在调研持续集成的框架,在本地部署过一套环境,在此记录一下
安装本地环境
Gitlab
安装Gitlab
修改本机host文件
测试本机设置是否成功
使用24端口具体碰到到问题参见:gitlab docker
Gitlab Runner
安装Gitlab Runner
docker run -d --name docker-gitlab-runner --restart always \ --link docker-gitlab:gitlab.basebit.ai \ -v ~/workspace/docker/gitlab-runner/config:/etc/gitlab-runner \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /usr/local/bin/docker:/usr/bin/docker \ gitlab/gitlab-runner:latest
注: linux和macOs的不同处
注册Runner
进入gitlab runner容器
docker exec -it docker-gitlab-runner /bin/bash
在容器内执行注册命令
Specific Runners和Shared Runners的区别
碰到的问题
由于使用的是本地域名,如果在注册runner中未设置过host,碰到连接失败问题参见如下
Gitlab-CI: Failed to connect to gitlab.basebit.ai port 80: Connection refused
项目加入CI/CD
样例参考: gitlab ci nodejs
参考
The text was updated successfully, but these errors were encountered: