我正在为我的项目安装个人跑步器。
sudo docker run --rm -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register \ --non-interactive \ --executor "docker" \ --docker-image docker:stable \ --url "https://gitlab.com" \ --registration-token "my-token" \
--description "docker-runner privileged" \ --tag-list "docker,aws, gara" \ --run-untagged="true" \ --locked="false" \
--access-level="not_protected" \ --docker-privileged
有了这个跑步者,我就可以成功地一步一步测试,构建和分析我的maven projet。
对于步骤Docker构建,我始终具有:
无法通过tcp:// docker:2375连接到Docker守护程序。是个 docker守护进程正在运行?错误:作业失败:退出代码1
完整日志:
在docker-runner上使用gitlab-runner 13.1.1(6fbc7474)运行 特权GYDNagVx准备“ docker”执行程序00:21使用Docker 具有图像docker:latest的执行程序...启动服务docker:dind ... 提取docker镜像docker:dind ...使用docker镜像 sha256:b3893e48cf281b58a763fb90904fd5d63595f9e5ae5736ee2d892a2dea6a371a 对于docker:dind ...等待服务启动并运行... 提取docker image docker:latest ...使用docker image sha256:809cc4dba987efb4641d5b6fef38f47abcde1bc5c5e9850616f0ed3552737e8c 对于docker:latest ...准备环境00:04在 Runner-gydnagvx-project-15477556-concurrent-0通过e59663817b22 ... 从Git仓库获取源代码00:07使用git获取更改 深度设置为50 ...重新初始化现有的Git存储库 /builds/gara-project/back-end-micro-services/msearch/.git/检查 80fcdd6e开发出来...删除目标/跳过Git子模块 设置下载工件00:18下载工件 maven-build(788252737)...从协调器下载工件... ok id = 788252737 responseStatus = 200 OK令牌= jjUorX2D执行中 工作脚本的“ step_script”阶段00:27 $ docker login -u “ $ {registry_user}” -p“ $ {registry_pass}”“ $ {registry_url}”警告! 通过CLI使用--password是不安全的。使用--password-stdin。 警告!您的密码将以未加密的方式存储在 /root/.docker/config.json。配置凭据助手以将其删除 这个警告。看到 https://docs.docker.com/engine/reference/commandline/login/#credentials-store 登录成功$ docker build -t “ $ {registry_url} / $ {image_name}:$ {image_tag}”。无法连接到 Docker守护程序位于tcp:// docker:2375。泊坞窗守护程序正在运行吗? 错误:作业失败:退出代码1
这似乎是一个常见的错误,但是在互联网上找不到任何解决方案对我有用。 我的gitla-ci.yml文件:
include:
- local: '/templates/.gitlab-ci-common-template.yml'
variables:
SPRING_PROFILES_ACTIVE: test
MAVEN_CLI_OPTS: "-s .m2/settings.xml --batch-mode"
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
DOCKER_TLS_CERTDIR: ""
default:
image: maven:3.6.3-jdk-8-slim
cache:
key: "$CI_COMMIT_REF_NAME"
paths:
- .m2/repository/
- target/
stages:
- test
- build
- analysis
- docker
- scan
- deploy
- delivery
maven-test:
stage: test
extends:
- .ci_only
- .skip_build
script:
- mvn test
artifacts:
reports:
junit:
- target/surefire-reports/TEST-*.xml
maven-build:
stage: build
extends:
- .ci_only
- .skip_build
script:
- "./mvnw -Pint clean install -DskipTests=true"
artifacts:
paths:
- target/*
expire_in: 1 week
docker-build:
image: docker:latest
services:
- docker:19.03.0-dind
cache: {}
before_script:
- docker login -u "${registry_user}" -p "${registry_pass}" "${registry_url}"
stage: docker
dependencies:
- maven-build
extends:
- .skip_build
- .ci_only
script:
- docker build -t "${registry_url}/${image_name}:${image_tag}" .
- docker run -d --name ${image_tag} "${registry_url}/${image_name}:${image_tag}"
- sleep 60 && docker ps && docker logs ${image_tag}
- if [ $(docker inspect -f '{{.State.Running}}' ${image_tag}) = "true" ]; then echo "Application well started"; else exit 1; fi
- docker rm -f ${image_tag}
- docker push "${registry_url}/${image_name}:${image_tag}"
docker_release_image:
image: docker:latest
stage: delivery
before_script:
- docker login -u "${registry_user}" -p "${registry_pass}" "${registry_url}"
# - docker login -u "${registry_prod_user}" -p "${registry_prod_pass}" "${registry_prod_url}"
services:
- docker:19.03.0-dind
script:
- docker pull "${registry_url}/${image_name}:${image_tag}"
- docker tag "${registry_url}/${image_name}:${image_tag}" "${registry_url}/${image_name}:${CI_COMMIT_TAG/*v/}"
- docker tag "${registry_url}/${image_name}:${image_tag}" "${registry_url}/${image_name}:latest"
# - docker tag "${registry_url}/${image_name}:${image_tag}" "${registry_prod_url}/${image_name}:${CI_COMMIT_TAG/*v/}"
- docker push "${registry_url}/${image_name}:${CI_COMMIT_TAG/*v/}"
- docker push "${registry_url}/${image_name}:latest"
# - docker push "${registry_prod_url}/${image_name}:${CI_COMMIT_TAG/*v/}"
- docker rmi "${registry_url}/${image_name}:${image_tag}"
when: manual
extends:
- .only_tag_on_master
请问我该如何纠正? 谢谢