我是GitLab用户。我用groff脚本制作了一本900页的书。输出将存储在输出文件夹中。当作者进行一些更改并推入GitLab时,Docker镜像将产生这本书。
这个想法是构建一个docker容器并将该容器存储在GitLab注册表中。容器的构建工作正常,但出现错误消息。
错误在运行脚本中。 docker登录不正确。
image: docker:latest
variables:
DOCKER_DRIVER: overlay2
CONTAINER_IMAGE: registry.gitlab.com/test
DOCKER_IMAGE: paperboy
TAG: 0.1.0
services:
- docker:dind
stages:
- build
- release
- run
before_script:
- docker login registry.gitlab.com --username gitlab+deploy-token-0000 --password 3435563
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin
- apk update && apk add --no-cache
- rm -rf /var/cache/apk/*
build:
stage: build
script:
- docker build -t $CONTAINER_IMAGE/$DOCKER_IMAGE .
- docker push $CONTAINER_IMAGE/$DOCKER_IMAGE
release:
stage: release
script:
- docker pull $CONTAINER_IMAGE/$DOCKER_IMAGE
- docker tag $CONTAINER_IMAGE/$DOCKER_IMAGE:latest $CONTAINER_IMAGE/$DOCKER_IMAGE:$TAG
- docker push $CONTAINER_IMAGE/$DOCKER_IMAGE:$TAG
only:
- master
run:
stage: run
script:
- docker pull $CONTAINER_IMAGE/$DOCKER_IMAGE
- docker run --rm -v $(pwd)/data/:/home/data
-v $(pwd)/output/:/home/output
-v $(pwd)/output/csv/:/home/output/csv
-v $(pwd)/output/pdf/:/home/output/pdf paperboy
- rm -rf "%CACHE_PATH%/%CI_PIPELINE_ID%"
only:
- master
这是我的.gitlab-ci.yml中运行脚本的想法。我收到此错误消息:
$ docker run --rm
-v $(pwd)/data/:/home/data
-v $(pwd)/output/:/home/output
-v $(pwd)/output/csv/:/home/output/csv
-v $(pwd)/output/pdf/:/home/output/pdf $CONTAINER_IMAGE/$DOCKER_IMAGE
- git add .
docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"-\": executable file not found in $PATH": unknown.
time="2019-09-10T10:55:51Z" level=error msg="error waiting for container: context canceled"
ERROR: Job failed: exit code 127
run:
stage: run
script:
- docker login registry.gitlab.com -u gitlab+deploy-token-95492 -p $DEPLOY_TOKEN
- docker pull $CONTAINER_IMAGE/$DOCKER_IMAGE
- docker images | grep paperboy
- docker run --rm
-v $(pwd)/data/:/home/data
-v $(pwd)/output/:/home/output
-v $(pwd)/output/csv/:/home/output/csv
-v $(pwd)/output/pdf/:/home/output/pdf
$CONTAINER_IMAGE/$DOCKER_IMAGE
- git add .
- git commit -m "Update"
- git push origin master
- rm -rf "%CACHE_PATH%/%CI_PIPELINE_ID%"
only:
- master
答案 0 :(得分:0)
有关密码未加密存储的警告可以忽略。
对于运行错误,您已将list.append
指定为映像,而不是paperboy
。由于您已经具有将图像名称组合在一起的变量,因此您可能应该使用它们,而不是硬编码的registry.gitlab.com/test/paperboy
值。
paperboy
答案 1 :(得分:0)
您应该在 GitLab runner 机器上安装 pass
包。
如果你的机器是 Ubuntu,那么执行这个 cmd:
apt install pass