49 lines
2.2 KiB
Markdown
49 lines
2.2 KiB
Markdown
---
|
||
author: mikeconrad
|
||
categories:
|
||
- Automation
|
||
- Docker
|
||
- OCI
|
||
- Self Hosted
|
||
dark_fusion_page_sidebar:
|
||
- sidebar-1
|
||
dark_fusion_site_layout:
|
||
- ""
|
||
date: "2024-03-07T10:07:07Z"
|
||
tags:
|
||
- Blog Post
|
||
title: Self hosted package registries with Gitea
|
||
---
|
||
|
||
I am a big proponent of open source technologies. I have been using [Gitea](https://about.gitea.com/) 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](https://docs.gitea.com/usage/packages/overview?_highlight=packag). 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:
|
||
|
||
```shell
|
||
# 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:
|
||
|
||
 |