I am a GitLab User. I produce with a groff script a book with 900 pages. The output will be stored in the output folder. When an author make some changes and push into GitLab, the Docker image will produce this book.
The idea is to build a docker container and store the container in the GitLab registry. The build of the container works fine, but I get an error message.
Please take a look in the before_script in my .gitlab-ci.yml.
$ echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
The second error is in the run script. The docker login in not correct.
registry.gitlab.com/test/paperboy:latest
$ docker run --rm -v $(pwd)/data/:/home/data -v $(pwd)/output/:/home/output -v $(pwd)/output/csv/:/home/output/csv paperboy
Unable to find image 'paperboy:latest' locally
docker: Error response from daemon: pull access denied for paperboy, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
ERROR: Job failed: exit code 125
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