GitLab build docker on kubernetes runner - docker

I've just connected my gitlab account to an existing kubernetes cluster. Then I generated a private runner on the cluster. In the pipeline, I wanted to build a docker image, but I always get the error, can't connect to the docker daemon. I realized, probably because privileged is not true, but I can't really find the solution, how can I create the private runner as a privileged one.
edit: I created the runner through the gitlab GUI, https://gitlab.com/ORG/PROJ/-/clusters/CLUSTER_ID?tab=apps and there I clicked the install runner button.

Related

GitHub Container Actions in Containerised Runner

I have deployed a pool of self hosted GitHub runners as pods to my kubernetes cluster. Some of our pipelines contain jobs which run container actions. Is it possible to run those jobs in this type of runner?
Docker in Docker is configured in the deployment, and I can build docker images and push them to the container registry.
I note that the GitHub docs state:
If you want to run workflows that use Docker container actions or service containers, you must use a Linux machine and Docker must be installed.
I've struggled to find any definitive answers to this online

connecting to an insecure local docker registry in uncontrolled CI environment

I'm building a microservice that performs operations on a docker registry.
The microservice i'm building has a test which starts a docker-registry via the docker-registry image in Docker Hub, so the microservice can connect to it, set it up, work on it etc...
The test fails in CI: The Docker client can't connect to the test-registry because it's insecure. This is in CI, and dynamic, different random ip/port each time, and the docker daemon is used by other parallel tests... so having the test edit the global jsons and restarting docker daemon seems like a bad solution.
Has anyone solved this? how do you test integration with docker-registry in CI? am i doomed to modify the global docker jsons and restart/trigger reload of config?
Some specifics:
The build tool is Bazel and runs in GCB so the test itself runs in RBE workers on the Google cloud which are isolated and don't have network access when running the tests and i can't really configure too much, it's not my machine, it's a radon machine each time for each test etc...
we ended up starting another container that has a docker daemon in it (without mounting the external docker daemon socket, so it's actually another docker daemon instance).
we do this at our leisure, so only after we know the private registry address and configure the docker daemon to startup with insecure registry flag.
in order for the containers to communicate we had their container have a name and share a network.

Gitlab-runner installation

I installed gitlab and docker in Ubuntu. Now I need to install gitlab-runner using docker executor. Is it necessary for the gitlab to be running in docker or is it enough if both runs on the same machine?
GitLab Runner is the open source project that is used to run your jobs and send the results back to GitLab. So it just needs connectivity to Gilab and its done by registering the runner. Registering runner
Registering a Runner is the process that binds the Runner with a GitLab instance.
If you want to use Docker, GitLab Runner requires a minimum of Docker v1.13.0.
Allows to run:
Multiple jobs concurrently.
Use multiple tokens with multiple server (even per-project).
Limit number of concurrent jobs per-token.
Jobs can be run:
Locally.
Using Docker containers.
Using Docker containers and executing job over SSH.
Using Docker containers with autoscaling on different clouds and virtualization hypervisors.
Connecting to remote SSH server.
The GitLab Runner version should be in sync with the GitLab version, features may be not available or work properly if there’s a version difference.

How to run build on docker container in coreos?

I have installed CoreOS as my build environment. I installed Jenkins server as a docker container in CoreOS. And I created a free style project on the Jenkins server to build my project. How can I configure the build run on docker containers on the CoreOS?
So the structure is: CoreOS is my physical machine. Jenkins server is running in a docker container in the CoreOS. And I want to launch more docker containers to run my application. How can I achieve this? The hardest part I think is to launch a docker container in CoreOS from Jenkins JOB. I want to start a new docker container ever time for a build.
I'm not familiar with Jenkins, but I would suggest that you take a look at the docker-machine and docker-compose utilities.
You should be able to have Jenkins use one of those to have the host start your build container.

How to setup gitlab container registry inside docker?

I have got gitlab running inside the docker container on my localhost. I want to test gitlab container registry also in my localhost. But I don't know how to setup container registry inside docker container. I am using this instruction: http://docs.gitlab.com/ce/administration/container_registry.html#container-registry-domain-configuration and I have tried to do steps from "Installations from source", but it doesn't created "Container Registry" option in repo settings in gitlab ui. So there is one option: "Omnibus GitLab installations", but there is requirement to use https.

Resources