Files
hackanooga.com/content/post/2024-03-07-self-hosted-package-registries-with-gitea.md
2025-02-19 18:15:27 -05:00

2.4 KiB
Raw Blame History

author, categories, dark_fusion_page_sidebar, dark_fusion_site_layout, date, tags, title
author categories dark_fusion_page_sidebar dark_fusion_site_layout date tags title
mikeconrad
Automation
Docker
OCI
Self Hosted
sidebar-1
2024-03-07T10:07:07Z
Blog Post
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 didnt 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 dont necessarily want them on a public registry. Im 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.

![](https://wordpress.hackanooga.com/wp-content/uploads/2024/03/image-6-1024x313.png)
You can see that the package type is container. Clicking on it will give you more information:
![](https://wordpress.hackanooga.com/wp-content/uploads/2024/03/image-7-1024x437.png)