An error occurred while fetching the assigned iteration of the selected issue.
gitlab-runner exec docker does not find repo
I am having trouble running the gitlab-runner exec command using the docker executor. The git repo cannot be found.
I have the following setup:
- Windows 10, running Docker for Windows
- Docker + gitlab-ci-multi-runner installed in a container with the Docker file below
FROM phusion/baseimage:0.9.19
RUN apt-get update \
&& sh -c "curl -sSL https://get.docker.com/ | sh" \
&& sh -c "curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.deb.sh | bash" \
&& apt-get install -y gitlab-ci-multi-runner \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
CMD ["/sbin/my_init"]
I run the image (built with -t docker-gitlab-runner:snapshot
) above with:
$ docker run --rm -it --name gt -v C:/Users/jnaous:/home/jnaous -v /var/run/docker.sock:/var/run/docker.sock -v C:/Users/jnaous/gitlab/config:/etc/gitlab-runner docker-gitlab-runner:snapshot /sbin/my_init -- bash -l -i
My git repo is now mounted in the container at /home/jnaous/candidguru/candidly
. Now the .gitlab-ci.yml file I'm running also starts up docker:dind
as a service.
root@82ab4874f85f:/# cd /home/jnaous/candidguru/candidly
root@82ab4874f85f:/home/jnaous/candidguru/candidly# gitlab-runner --debug exec docker --docker-privileged --env CI_REGISTRY=registry.gitlab.com --env CI_REGISTRY_IMAGE=registry.gitlab.com/candidguru/candidly build
Runtime platform arch=amd64 os=linux revision=01b3ea1 version=1.6.0
WARNING: You most probably have uncommitted changes.
WARNING: These changes will not be tested.
Running with gitlab-ci-multi-runner 1.6.0 (01b3ea1)
Shell configuration: environment: []
dockercommand:
- sh
- -c
- "if [ -x /usr/local/bin/bash ]; then\n\texec /usr/local/bin/bash \nelif [ -x /usr/bin/bash
]; then\n\texec /usr/bin/bash \nelif [ -x /bin/bash ]; then\n\texec /bin/bash \nelif
[ -x /usr/local/bin/sh ]; then\n\texec /usr/local/bin/sh \nelif [ -x /usr/bin/sh
]; then\n\texec /usr/bin/sh \nelif [ -x /bin/sh ]; then\n\texec /bin/sh \nelse\n\techo
shell not found\n\texit 1\nfi\n\n"
command: bash
arguments: []
passfile: false
extension: ""
build=1 project=1
Using Docker executor with image registry.gitlab.com/candidguru/docker-builder:0.6 ...
Applying docker.Client transport fix: &{false 0xc820102ff0 <nil> 0xc820218550 unix:///var/run/docker.sock 0xc820154280 0xc8201f8a20 [1 18] [] [] <nil>} host=unix:///var/run/docker.sock
Creating build volume... build=1 project=1
Looking for prebuilt image gitlab-runner-prebuilt-x86_64:01b3ea1 ... build=1 project=1
Starting cache container d72e1b80dc58db6dce4cb622fc08c764cc8a0367d9d0241b59a60bac1174af6c ... build=1 project=1
Waiting for cache container d72e1b80dc58db6dce4cb622fc08c764cc8a0367d9d0241b59a60bac1174af6c ... build=1 project=1
Creating services... build=1 project=1
Looking for image docker:dind ... build=1 project=1
Pulling docker image docker:dind ...
Removed container runner--project-1-concurrent-0-docker with No such container: runner--project-1-concurrent-0-docker build=1 project=1
Starting service docker:dind ...
Creating service container runner--project-1-concurrent-0-docker ... build=1 project=1
Starting service container a64c32bcaf29813fd76f0d3278fb74624750ce420061d467bb91787dfe4e2342 ... build=1 project=1
Created service docker:dind as a64c32bcaf29813fd76f0d3278fb74624750ce420061d467bb91787dfe4e2342 build=1 project=1
Waiting for services to be up and running...
Looking for prebuilt image gitlab-runner-prebuilt-x86_64:01b3ea1 ... build=1 project=1
Waiting for service container runner--project-1-concurrent-0-docker to be up and running... build=1 project=1
Removed container ad1e4c171f26e017455c2148710ca3349d1d87956ca04316445c2a8470a6f67c with <nil> build=1 project=1
Creating user-defined volumes... build=1 project=1
Using host-based /home/jnaous/candidguru/candidly for /home/jnaous/candidguru/candidly:ro ... build=1 project=1
Starting Docker command... build=1 project=1
Looking for prebuilt image gitlab-runner-prebuilt-x86_64:01b3ea1 ... build=1 project=1
Looking for image sha256:8c07ce54c5aed575c42e26316f99a8ebf78428d356c11a5c606566961a49694c ... build=1 project=1
Removed container runner--project-1-concurrent-0-predefined with No such container: runner--project-1-concurrent-0-predefined build=1 project=1
Creating container runner--project-1-concurrent-0-predefined ... build=1 project=1
Looking for image registry.gitlab.com/candidguru/docker-builder:0.6 ... build=1 project=1
Pulling docker image registry.gitlab.com/candidguru/docker-builder:0.6 ...
Removed container runner--project-1-concurrent-0-build with No such container: runner--project-1-concurrent-0-build build=1 project=1
Creating container runner--project-1-concurrent-0-build ... build=1 project=1
Waiting for signals... build=1 project=1
Executing on runner--project-1-concurrent-0-predefined the set -eo pipefail
set +o noclobber
: | eval $'echo "Running on $(hostname) via 82ab4874f85f..."\nexport CI_REGISTRY=$\'registry.gitlab.com\'\nexport CI_REGISTRY_IMAGE=$\'registry.gitlab.com/candidguru/candidly\'\nexport CI=$\'true\'\nexport CI_BUILD_REF=$\'2447b1218dcec5d774ea79606dbacebbc2a7520f\'\nexport CI_BUILD_BEFORE_SHA=$\'db1c7734817b0df6a53edbe382826bdae522744d\'\nexport CI_BUILD_REF_NAME=$\'jn-add-webdriver\'\nexport CI_BUILD_ID=1\nexport CI_BUILD_REPO=$\'/home/jnaous/candidguru/candidly\'\nexport CI_BUILD_TOKEN=\'\'\nexport CI_PROJECT_ID=1\nexport CI_PROJECT_DIR=$\'/builds/project-1\'\nexport CI_SERVER=$\'yes\'\nexport CI_SERVER_NAME=$\'GitLab CI\'\nexport CI_SERVER_VERSION=\'\'\nexport CI_SERVER_REVISION=\'\'\nexport GITLAB_CI=$\'true\'\nexport CANDIDGURU_SQLALCHEMY_DATABASE_URI=$\'mysql+mysqlconnector://root:password@mysql:3306/candidguru\'\nexport DOCKER_DRIVER=$\'overlay\'\nexport CANDIDGURU_REQUIRE_EMAIL_VERIFICATION=$\'True\'\nexport MYSQL_ROOT_PASSWORD=$\'password\'\nexport CANDIDGURU_MAIL_SUPPRESS_SEND=$\'False\'\nexport MYSQL_DATABASE=$\'candidguru\'\nexport CANDIDGURU_DEBUG=1\nexport CANDIDGURU_UNIQUE_DB_PER_TEST=$\'False\'\nexport CANDIDGURU_SECRET_KEY=$\'testkey\'\nexport CANDIDGURU_SQLALCHEMY_ECHO=$\'True\'\nexport CANDIDGURU_SQLALCHEMY_TEST_DATABASE_URI=$\'mysql+mysqlconnector://root:password@mysql:3306/candidguru\'\n$\'mkdir\' "-p" "/builds/project-1.tmp/git-template"\n$\'rm\' "-r" "-f" "/builds/project-1"\n$\'git\' "config" "-f" "/builds/project-1.tmp/git-template/config" "fetch.recurseSubmodules" "false"\necho $\'\\x1b[32;1mCloning repository...\\x1b[0;m\'\n$\'git\' "clone" "/home/jnaous/candidguru/candidly" "/builds/project-1" "--template" "/builds/project-1.tmp/git-template"\n$\'cd\' "/builds/project-1"\necho $\'\\x1b[32;1mChecking out 2447b121 as jn-add-webdriver...\\x1b[0;m\'\n$\'git\' "checkout" "-q" "2447b1218dcec5d774ea79606dbacebbc2a7520f"\n'
build=1 project=1
Starting container 6acbfca3e9e84a6a06a5d00245535638acc10e7deaf52248a83732c4cabe5902 ... build=1 project=1
Attaching to container 6acbfca3e9e84a6a06a5d00245535638acc10e7deaf52248a83732c4cabe5902 ... build=1 project=1
Running on runner--project-1-concurrent-0 via 82ab4874f85f...
Cloning repository...
fatal: repository '/home/jnaous/candidguru/candidly' does not exist
Waiting for container 6acbfca3e9e84a6a06a5d00245535638acc10e7deaf52248a83732c4cabe5902 ... build=1 project=1
Container 6acbfca3e9e84a6a06a5d00245535638acc10e7deaf52248a83732c4cabe5902 finished with exit code 1 build=1 project=1
ERROR: Build failed: exit code 1
Removed container af5485f4e831c65bcfdacdfa3fc6db4318e7c495a9b7134c7a77edece15d2374 with <nil> build=1 project=1
Removed container d72e1b80dc58db6dce4cb622fc08c764cc8a0367d9d0241b59a60bac1174af6c with <nil> build=1 project=1
Removed container 6acbfca3e9e84a6a06a5d00245535638acc10e7deaf52248a83732c4cabe5902 with <nil> build=1 project=1
Removed container a64c32bcaf29813fd76f0d3278fb74624750ce420061d467bb91787dfe4e2342 with <nil> build=1 project=1
Closed all idle connections for docker.Client: &{false 0xc8201031d0 <nil> 0x39d8ee0 unix:///var/run/docker.sock 0xc820154280 0xc8201f8a20 [1 18] [1 24] [1 18] 0xc820103230}
FATAL: exit code 1
For some reason, the repo is not found, even though I think it is actually getting mounted according to the log: Using host-based /home/jnaous/candidguru/candidly for /home/jnaous/candidguru/candidly:ro