Self hosted package registries with Gitea

I am a big proponent of open source technologies. I have been using Gitea for a couple years now in my homelab. A few years ago I moved most of my code off of Github and onto my self hosted instance. I recently came across a really handy feature that I didn’t know Gitea had and was pleasantly surprised by: Package Registry. You are no doubt familiar with what a package registry is in the broad context. Here are some examples of package registries you probably use on a regular basis:

  • npm
  • cargo
  • docker
  • composer
  • nuget
  • helm

There are a number of reasons why you would want to self host a registry. For example, in my home lab I have some Docker images that are specific to my use cases and I don’t necessarily want them on a public registry. I’m also not concerned about losing the artifacts as I can easily recreate them from code. Gitea makes this really easy to setup, in fact it comes baked in with the installation. For the sake of this post I will just assume that you already have Gitea installed and setup.

Since the package registry is baked in and enabled by default, I will demonstrate how easy it is to push a docker image. We will pull the default alpine image, re-tag it and push it to our internal registry:

# Pull the official Alpine image
docker pull alpine:latest

# Re tag the image with our local registry information
docker tag alpine:latest git.hackanooga.com/mikeconrad/alpine:latest

# Login using your gitea user account
docker login git.hackanooga.com

# Push the image to our registry
docker push git.hackanooga.com/mikeconrad/alpine:latest

Now log into your Gitea instance, navigate to your user account and look for packages. You should see the newly uploaded alpine image.

You can see that the package type is container. Clicking on it will give you more information: