2017-09-05 120 views
0

我想建立和推动泊坞窗图片到我的本地关系回购与GitLab CI构建和推动泊坞窗图像

这是我目前的CI文件:

image: docker:latest 

services: 
    - docker:dind 

before_script: 
    - docker info 
    - docker login -u some_user -p nexus-rfit some_host 

stages: 
    - build 

build-deploy-ubuntu-image: 
    stage: build 
    script: 
    - docker build -t some_host/dev-image:ubuntu ./ubuntu/ 
    - docker push some_host/dev-image:ubuntu 
    only: 
    - master 
    when: manual 

也有工作对于阿尔平泊坞窗,但是当我要运行它的任何它的失败,并出现以下错误:

Checking out 13102ac4 as master... Skipping Git submodules setup $ docker info Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? ERROR: Job failed: exit code 1

所以技术上图像中的码头工人守护程序没有运行,但我不知道为什么?

回答

2

GitLab人员在他们的文档中提供了有关在基于Docker的作业中使用docker-build的参考文档:https://docs.gitlab.com/ce/ci/docker/using_docker_build.html#use-docker-in-docker-executor。由于您似乎拥有一切(即作业的正确映像以及额外的docker:dind服务),因此很可能是跑步者配置问题。

如果你看一下在文档第二步:

  1. Register GitLab Runner from the command line to use docker and privileged mode:

    [...]

    Notice that it's using the privileged mode to start the build and service containers. If you want to use docker-in-docker mode, you always have to use privileged = true in your Docker containers.

也许你正在使用一个亚军是不是在特权模式配置,因此不能正常运行里面的码头工人守护进程。您可以直接编辑您注册的跑步者上的/etc/gitlab-runner/config.toml以添加该选项。

(另外,请阅读文档部分,了解有关与您选择的存储驱动程序相关的性能的更多信息/您的亚军在使用dind时支持的功能)