Found out that I needed to include the docker socket in the gitlab-runner configuration as well, and not only have it available in the container.
By adding --docker-volumes '/var/run/docker.sock:/var/run/docker.sock' and removing DOCKER_HOST=tcp://docker:2375 I was able to connect to docker on my host system and spawn sibling containers.
linux - Deploy docker container using gitlab ci docker-in-docker setup - Stack Overflow
Docker build with Gitlab CI/CD
GitLab Runner in Docker
CI/CD Dilemma for Python Project: To go for Docker in Docker or not?
Hey cool docker cats, I have a hopefully common problem that I’ve not been able to locate any resources to help me along.
I have a python repo that supports other repos. Currently in the subsequent repo build pipelines I install the python file to be used as part of the test pipeline for the repo. Ideally, I want to build a docker image after each successful git commit pipeline to the main python supporting utility. Then use that newly created image as the base image in my other repo pipelines for subsequent tests related to the given repo.
Hopefully clear, can you point to any helpful resources or walk me through an example? This seems super basic in my head but haven’t connected the dots.
Cheers
Hi all,
We recently moved to GitLab, and I am tasked with setting up the testing stuff for our pipeline.
We had gitlab runners recently installed on our server, but I am running into some problems. I’m new to all this, so while reading documentation has been helpful, I’m still unsure on a lot of things.
The Gitlab-Runner is installed and registered on 3 separate docker containers in the server (so 3 runners total)
The docker containers use the official docker alpine gitlab runner image
The Gitlab-Runner is in shell executor mode
When I run my script through gitlab-ci, I am getting command not found for sudo, apt, node, npm, docker, etc.
From what i can tell, that’s because the runner is running the CI script directly in the docker container from the official images, which do not have any of these installed.
So even if I switch from shell executor to docker executor, this would not work since the official runner image doesn’t have docker installed correct?
Is the correct path here to start docker containers with gitlab runners registered in it, but the docker container itself needs to be docker in docker? Is the official gitlab runner alpine image able to run in docker in docker?
Hi.
I'm trying to create a ci/cd pipeline for our teams, which each develop a certain ML microservice which is containrized in a docker image. Our gitlab is selfhosted and we also have a dedicated server which is supposed to host the runner.
From what I've found out till now, in the CI/CD pipeline, we should:
-
For a merge request:
-
Unit Test the developed software.
-
Check the quality of code.
-
-
After a couple of merges, create a release branch:
-
Acceptance tests.
-
Deploy to staging
-
-
After each commit in the release branch:
-
Update the staging.
-
-
Merge to master:
-
Deploy to production.
-
We also use a very well defined python environment for our images, and that isolated environment almost never changes considerably. (The base image is labelled as `myrepo/custom_python_image` for example).
So playing by gitlab there seems to be 2 options:
-
Using docker in docker in the CI pipeline. In this way I can unit test in the GitLab runner container.
-
Using shell for my CI pipeline. In this way I have to migrate the tests inside my built docker container.
The problem with docker in docker was that I could not cache pulled images, (or large binaries), and hence made it slow.
-
Is there anyway to make DinD work for image caches?
-
Does it worth the hassle?
-
Is there any alternative to DinD or shell at all?
Thanks!
P.S: If the question was a bit unclear, sorry for that. English is not my first language so my writing my come as disjointed.