- Docker Install Linux
- Docker Install Gitlab Runner
- Docker Install Gitlab Ubuntu
- Docker Install Gitlab Download
- Docker Install Gitlab Chrome
- Docker Install Windows
I tried this once with a Digital Ocean Droplet that already had Docker installed and once on Azure where I had to install Docker manually. Follow the Docker installation on the machine and also the post installation needed on Linux to allow non-root user to run docker. Enable it for the user gitlab-runner. Install GitLab Runner. Jan 02, 2018 Yes, you can run gitlab-ce on windows using Docker. First, make sure docker is installed on Windows, otherwise install it. A detailed documentation for how to run gitlab using Docker is found under GitLab Docker images including how to access the web interface. Install Docker and Docker Compose; Setup GitLab Docker Project; Build a GitLab Container; GitLab Post Installation; Step 1 - Install Docker and Docker Compose. First, we will install the docker and docker-compose packages to our Ubuntu 20.04 system. And we will be using the docker packages provided by the official Ubuntu FocalFossa repository.
If you are using Gitlab as a code repository, having an automated build/test/deployment process is becoming more and more common (and more and more necessary in order to scale as your team/project grows and accommodate a faster turn-around for deployments). I definitely learned a lot from my first time setting up my CI process, so in this post I’ll show you exactly what steps to follow to install a Docker Gitlab Runner on Windows.
There are many popular continuous integration/deployment platforms (circleci, jenkins), but if you’re already hosting your code in Gitlab, setting up Gitlab CI is a breeze.
Docker Install Linux
If you’re looking to setup Gitlab CI from scratch, check out the official Gitlab docs
Once you’ve got a repo setup to run continuous integration, you’ll need to create a runner in order to process and run the continuous integration jobs. Gitlab provides multiple executors that you can choose from, but in this tutorial I’ll be using the Docker executor.
Gitlab Docker CI Executor
Docker Install Gitlab Runner
Gitlab has a Docker image that comes with the gitlab-runner pre-installed, so we’ll be using that to run our CI jobs. Once we spin up a container from this image, it will listen for jobs and spin up a new container to process each job that it receives.
I prefer using the Gitlab Docker runner over the normal shell runner since Docker containers ensures that all jobs are in isolated environments, and I can provide my own Dockerfile if I have jobs that require special setup steps or specific dependencies. The last thing I want is to have a shared environment that is shared between all my builds.
Create a Gitlab Runner with Docker
- Install docker desktop
- Install Docker then open CMD and type
docker versionto make sure it is working correctly
- Install Docker then open CMD and type
- Since Docker is using virtual-machine technology, you’ll need to enable Hyper-V if not already enabled on the host machine.
- The easiest way to use PowerShell. Open a PowerShell terminal as Administrator
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
- Restart the machine
- You’ll need to pick a directory to use as the “home” directory of your Gitlab runner. This will store config files or anything else that the runner needs to persist
- I like to use C:gitlab-runner
- Create a config folder inside your runner “home” (e.g. C:gitlab-runnerconfig)
- Next we’ll create a Docker container for the runner, which will pick up the CI jobs from Gitlab repos and then spin up other Docker containers for each individual CI job that it processes.
- Run the following command to create a new Docker container for the gitlab runner
-dtells the container to run in the background (this way we can keep using the terminal)
--name gitlab-runner– Specifies the name of the container we’re creating (in this case we’re calling it gitlab-runner, but feel free to use any name you want)
--restart always– Always spin up the container when Docker starts
-v C:gitlab-runnerconfig:/etc/gitlab-runner– Here we are mounting a volume between the host machine and the container. This shared folder will be where the container stores its config files so that they persist even after the container shuts down. If you used a different container home, replace
C:gitlab-runnerwith whatever folder you used.
-v /var/run/docker.sock:/var/run/docker.sock– allows the runner to spin up Docker containers as sibling containers instead of child containers (Docker-in-Docker approach)
gitlab/gitlab-runner– the name of the Docker image we’re going to download and then spin up
Now that the container with the gitlab runner is running, we need to register the runner with Gitlab
Before we register, you’ll need a registration token from your Gitlab repo. From your repo, go to Settings > CI / CD. Find the Runners section and expand it to reveal the registration token.
Again, if you used a different “home” folder other than C:gitlab-runner, replace that path with the folder you created earlier.
Make sure to replace “REGISTRATION_TOKEN” with the registration token you grabbed earlier. If you’re running a private/enterprise version of Gitlab, replace the “https://gitlab.com” url with your own Gitlab URL.
Docker Install Gitlab Ubuntu
I set this runner to default to the “alpine:latest” docker image if no image is specified in the project’s .gitlab-ci.yml. Feel free to default to a different image if it suits your needs.
Unless you only want to run a single build at a time, you’ll want to enable concurrency for your gitlab runner.
- The first line should read
concurrent: 1— change this to the number of builds you’d like to be able to run in parallel
docker logs gitlab-runner – view logs
Currently (using Docker 18.09.2 and Gitlab Runner 11.10.1), there is an issue where if Docker restarts, when the gitlab-runner container spins back up automatically it will not properly re-attach the config volume.
docker restart gitlab-runner and it will restart with the volume properly attached.
Photo by Pankaj Patel on Unsplash
Install git, docker and docker-compose.
Note: don't forget docker's post-installation steps! (eg for linux).
Fetch the source:
Copy the environement variables file
Change some of those variables if you wish to,
notably the super-user username and password are created from
DJANGO_SU_PASSWORD, defaulting to admin:admin.
Build and run the docker containers
You should be able to access the website at http://localhost:8080/
Docker Install Gitlab Download
Use your GPU:
Docker Install Gitlab Chrome
- Install cuda & cudnn
- Create a file named
local.ymlwith this content
Docker Install Windows
- When you build use both yml files