How to Create Gitlab Runner Container on Docker (Tutorial). In this post, we will introduce GitLab, its advantages, then explain how to create GitLab runner container on Docker.
Gitlab is an open source repository management system for git, which has extensive features like code reviews, issue tracking, etc. All in all, Gitlab is a collaborative tool that helps manage repositories hosted on servers. Also provides issues tracking in the CI/CD pipeline functions using an open source license.
Initially, the repository was develop by Valery Sizov and Dmitry Zaporozhets which began as a project in 2011. Over time, the tool has become one of the popular platforms. Offers end to end DevOps capabilities and supports the software development lifecycle.
Today, many DevOps use the tool for the software development process. Free tool, written in Ruby and Go language, and is simple to manage. Additionally, you can set the tool in a few minutes.
Cisco, Juniper, and IBM Sony are a few high profile tech companies that use Gitlab to deploy and collaborate web based projects. Well, the GitLab project came into practice in 2011 to make the lives of developers easier. Using GitLab, DevOps create, store, deploy, and track private and public projects. Public repository generally helps in issue tracking and documentation.
Altogether, the platform further offers features like project management, bug tracking, and project analysis. Users view the project development insights and complete the development cycle on GitLab.
In GitLab, one can also pull requests from other developers and provide comments on their code. Basically, GitLab also allows us to import repositories from Google Code, Bitbucket, and others.
If the organization is just starting, the GitLab Free Plan offers a decent selection of features. On the other hand, the premium plan also gives managers access to project management and code integrity checks. Let us have a look at GitLab’s key features:
With GitLab, many organizations can improve their performance and deliver better results in less time. Cloud native application that is faster and more efficient than other software and app. Here are a few more benefits of using GitLab:
Easy to Configure
Developers find it easy to install the GitLab CI/CD tool. Well, it offers a private repository with limited access. Further, users can configure it in a container, on premises, or in a cloud. All you need to keep in mind is configuration requires you to create a virtual machine. Also requires a stick to pre-set configuration. Knowledge of Git on the command line can also help a user configure GitLab projects.
Deployment scheduling
To avoid conflicts, IT teams require their staff to perform constant monitoring of the performance as well as scheduling. But, it was a consuming task. As a result, with the introduction of GitLab, users could easily run CI/CD pipeline schedules. All you need to do is just specify a time for deployment management. This feature also immediately alerts you on noticing changes to the code.
Automates Building, Deploying, and Testing of codes in pipelines
Besides, Auto DevOps feature helps in building, testing, deploying, and tracking applications and their codes automatically via the CI/CD pipeline. Not only it saves time but also helps enforce standard practices. In order to take maximum benefit of the Auto DevOps feature, it is essential to integrate a Kubernetes cluster.
Generates maturity feedback
Consequently, GitLab offers Score boards that brief if developers are making appropriate use of GitLab features. Equally, it also helps in fixing bugs prior to the commencement of the process as well as shipping the right software. Further, using this feature, the teams measure which areas require an extension. Additionally, it helps to compare the activities with other organizations.
Source Code Security
Another benefit of GitLab is it offers various security measures for CI/CD pipelines. With the control over live codes, granular restrictions, and user permissions for Kerberos. Not to forget, a fully distributed version control system that allows developers to maintain, control and manage the code storage location. For example, the administration has full access to control and manage the server and location of codes. Also, they have the authority to store external codes.
Up next with How to Create Gitlab Runner Container on Docker (Tutorial) is to get to the main part of the article topic. Please read on.
By default, the latest version of Docker and Docker Compose is not included in the Ubuntu default repository. So you will need to install both packages from the Docker’s official repository.
First of all, download and add the Docker GPG key using the following command:
Before starting, you will need to create a group in GitLab and obtain a token to run the GitLab Runner. Step one:
1.Login to the GitLab web interface. You should see the following page:
2. Click on the + sign on the top screen then click on the Newgroup. You should see the following page:
3. After that, click on the Creategroup. You should see the following page:
4. Provide your group name, other informations and click on the Creategroup. You should see the following page:
5. Click on the Settings => CI/CD. You should see the following page:
6. Collapse the Runner section, disable shared runner for this group and click on the Take me there!. You should see the following page:
7. Click on the Register a group runner and copy the Registration token to safe place. You will require this token to register the Docker container in the next step.
Please verify the Docker image downloaded by the above command using the following command:
docker images
You will get the following output:
REPOSITORY TAG IMAGE ID CREATED SIZE
gitlab/gitlab-runner v14.3.2 0a20d405c892 13 months ago 2.53GB
Additionally, can also check the status of the running container using the following command:
docker ps
See the running container in the following output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
32fb2415a027 gitlab/gitlab-runner:v14.3.2 "/usr/bin/dumb-init …" 15 seconds ago Up 13 seconds gitlab-runner-container
Next, run the following command to register a new runner:
Once the container is successfully registered to the GitLab. You will get the following output:
Runtime platform arch=amd64 os=linux pid=18 revision=e0218c92 version=14.3.2
Running in system-mode.
Registering runner... succeeded runner=GR134894
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
At this point, the GitLab runner container is started and registered with GitLab. You can now visit the GitLab and verify the registered runner in your group’s “CI/CD Settings”:
Thank you for reading How to Create Gitlab Runner Container on Docker (Tutorial). We shall conclude.
How to Create Gitlab Runner Container on Docker (Tutorial) Conclusion
Summarizing, this post was about installing Docker and Docker Compose, obtaining a token from the GitLab, creating a GitLab runner container then verify it from the GitLab web interface. You can now use the GitLab runner to run the jobs over multiple machines and send the results to GitLab and which can be placed on separate users, servers, and local machine.
Overall, GitLab helps push your repositories, support collaboration, enable keeping track of development work, display projects, and more. Moreover, it is a collaborative tool with extensive features like issue tracking, task feeds, code reviews, etc. Users optimize the collaborative workflows to execute a software development lifecycle with GitLab. Have a look at its above listed features and advantages to better understand GitLab.
Have a look at more GitLab section in our blog over here.
I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.