Using Gitlab's Free Docker Registry

Using Gitlab's Free Docker Registry

Daily short news for you
  • How terrifying, Codeium - known as a competitor to Github Copilot, as it allows users to use it for free without limits. Recently, they introduced the Windsurf Editor - no longer just a VSCode Extension but a full Editor now - directly competing with Cursor. And the main point is that it... is completely free 🫣.

    » Read more
  • There is a rather interesting study that I came across: "Users never bother to read things they don't want to." (That's a bold statement, but it's more true than not. 😅)

    Don't believe it? I bet you've encountered situations where you've clicked on a button repeatedly and it doesn't respond, but in reality, it has displayed an error message somewhere. Or you've filled out everything and then when you hit the submit button, it doesn't go through. Frustrated, you scroll up or down to read and find out... oh, it turns out there's an extra step or two you need to take, right?

    It’s not far from the blog here. I thought that anyone who cares about the blog would click on the "Allow notifications" button just below the post. But the truth is, no one bothers to click it. Is it because they don't want to receive notifications? Probably not! I think it's because they just didn’t read that line.

    The evidence is that only when a notification pops up and takes up half the screen, or suddenly appears to grab attention, do they actually read it—and of course, it attracts a few more subscribers—something that was never achieved before.

    » Read more
  • A short article about the concepts of Functors, Applicatives, and Monads in functional programming that every time I read, I understand a little more 😅

    Functors, Applicatives, And Monads In Pictures

    » Read more

The Problem

Are you using Docker in any of your projects? If so, you must have encountered the need to store and share images. The default Docker Registry limits the number of private images you can have. This means that if you have multiple projects, you have to make these images public, which compromises the privacy of your projects.

Normally, some people choose to pay for Docker to get more private images. Others prefer to set up their own registry to store internal images. Docker provides an open-source solution for creating your registry. For more details, see the Docker Registry.

If you are an individual user and can't afford a paid service or don't have resources to set up your own registry, then this article is for you. Gitlab currently offers a completely free registry, all you need is a Gitlab account.

Usage

Gitlab's registry is tied to a repository. This means that to use it, you need to create repositories first. Images will be associated with repositories, and you can store them by pushing Docker images with the same name as the repository to Gitlab.

To use Gitlab's registry, follow these steps:

Step 1: Generate an Access Token by going to Profile > Preferences > Access Tokens. Enter a name for the token and make sure to select the "read & write registry" permission.

Access Token

After successfully generating the token, save it somewhere safe for future use.

Step 2: Log in to Gitlab's registry by running the following command:

$ docker login registry.gitlab.com

Enter your Gitlab username as the username and the Access Token generated in Step 1 as the password.

Step 3: Create a repository on Gitlab. For example, let's create a repository named "system".

Step 4: Build an image and make sure to name it the same as the Gitlab repository you created. For example:

$ docker build -t gitlab.com/hoaitx/system:latest .  

Step 5: Push the image as usual:

$ docker push gitlab.com/hoaitx/system:latest

Step 6: To check if the image has been uploaded to the registry, go to the repository you created, then navigate to Deploy > Container Registry. You will see all the images along with their tags.

Container Registry

This registry can be used for pulling and pushing images just like any other registry. However, it is a private registry, so you need to log in to perform any operations.

Limits

One concern when using free services is the limitations that come with them. It's strange that there isn't any specific documentation regarding the storage limit for images in Gitlab's registry. A search in the community led to the conclusion that there are no storage limits! You can refer to the Gitlab forum for more information.

Premium
Hello

5 profound lessons

Every product comes with stories. The success of others is an inspiration for many to follow. 5 lessons learned have changed me forever. How about you? Click now!

Every product comes with stories. The success of others is an inspiration for many to follow. 5 lessons learned have changed me forever. How about you? Click now!

View all

Subscribe to receive new article notifications

or
* The summary newsletter is sent every 1-2 weeks, cancel anytime.
Author

Hello, my name is Hoai - a developer who tells stories through writing ✍️ and creating products 🚀. With many years of programming experience, I have contributed to various products that bring value to users at my workplace as well as to myself. My hobbies include reading, writing, and researching... I created this blog with the mission of delivering quality articles to the readers of 2coffee.dev.Follow me through these channels LinkedIn, Facebook, Instagram, Telegram.

Did you find this article helpful?
NoYes

Comments (0)

Leave a comment...