Reputation: 71
I am trying to configure gitlab CI/CD runner. On the runner, I have deployed maven and java that builds my project and executes the test. So far so good, but the final step which it should pakage the code as a docker image and deploy fails. Here is the script which runs fine in cloud.But it says docker command not found in local, and I did not understand the workflow. Now for that to run, am I supposed to install docker on to my runner ? As the runner itself is a container inside docker. I could not figure out what should I do for this step to run. Please help.
docker-build:
stage: package
script:
- docker build -t registry.gitlab.com/imran_yusubov/gs-spring-boot-docker .
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
- docker push registry.gitlab.com/imran_yusubov/gs-spring-boot-docker
Upvotes: 0
Views: 1138
Reputation: 3185
How are you starting the runner?
The proper way to start the runner would be:
docker run -d --name gitlab-runner --restart always \
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest
Where you pass your docker socket and then in your pipeline you would have to call the docker:dind service in order to be able to run Docker in Docker which will allow you to build Docker images and run containers
You could find more info in this tutorial
Upvotes: 1