Home > Blockchain >  Running gitlab-runner on the command line in a docker container
Running gitlab-runner on the command line in a docker container

Time:04-26

I setup up gitlab-runner on my machine to run from a docker container as per these instructions. Then I try to run it with this command:

docker run -v /etc/gitlab-runner:/etc/gitlab-runner --rm -it gitlab/gitlab-runner exec docker test

I expect that this will run the 'test' stage of my .gitlab-ci.yml file using the 'docker' executor. Instead it exits with this message:

fatal: not a git repository (or any of the parent directories): .git

I also tried it with "--env CI_PROJECT_DIR=." but got the same result. Do I need to set some variable so that it will know what Git repo to clone? Or is it easier to just install the 'gitlab-runner' binary on my Linux box and use that for CLI testing?

CodePudding user response:

From the docs:

If you want to use the docker executor with the exec command, use that in context of docker-machine shell or boot2docker shell. This is required to properly map your local directory to the directory inside the Docker container.

gitlab-runner exec docker ...

doesn't seem to work at all in CLI.

CodePudding user response:

.gitlab-ci.yml Is there a git push operation in the file

  • Related