Var*_*orb 7 gitlab docker gitlab-ci gitlab-ci-runner alpine-linux
我有一个自定义的 gitlab ci,我想编译一个 Golang 应用程序并构建一个 docker 镜像。我决定为 gitlab 运行程序使用 alpine docker 镜像。我无法启动 docker。我尝试手动启动 docker 并收到错误 ( * WARNING: docker is already starting),如果我不手动启动 docker 服务,我会收到 ( Fails (Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?) 其他人也遇到过这种情况吗?
这不会是一个重复的问题。Gitlab 运行程序在 root 中运行 docker alpine 容器(通过运行 whoami 进行验证)。为了尝试,我确实尝试了usermod -aG docker $(whoami)并得到了相同的输出。
.gitlab-ci.yml
image: alpine
variables:
GO_PROJECT: linkscout
before_script:
- apk add --update go git libc-dev docker openrc
- mkdir -p ~/go/src/${GO_PROJECT}
- cp -r ${CI_PROJECT_DIR}/* ~/go/src/${GO_PROJECT}/
- cd ~/go/src/${GO_PROJECT}
- service docker start # * WARNING: docker is already starting
stages:
- compile
- build
compile:
stage: compile
script:
- go get
- go build -a
build:
stage: build
script:
- docker version # If I don't run (service docker start) I get this message: Fails (Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6853 次 |
| 最近记录: |