Run Gitea on Docker
Gitea is a self-hosted Git service that is popular among developers for its lightweight and easy-to-use interface. One of the easiest ways to install Gitea is by using Docker. Docker is a popular containerization platform that makes it easy to run applications in isolated environments. The Gitea team provide great support for Docker out of the box. They have automatically updated images in their Docker Hub organization and you can use the latest stable tag to get the freshest version.
In this post, we will discuss two methods of installing Gitea with Docker: with root and rootless.
Installing Gitea with Docker (root)
The first method is installing Gitea with Docker using root privileges. Gitea provides automatically updated Docker images that can be accessed from the Docker Hub organization. To install Gitea with Docker, you need to follow the official installation instructions and install docker-compose. Once you have installed docker-compose, you can create a volume and a network and start the gitea/gitea:latest image as a service. The setup will guide you through the process, and you can customize the installation by configuring environment variables.
Installing Gitea with Docker (rootless)
The second method is installing Gitea with Docker using rootless privileges. This method is similar to the first method, but it uses Gitea internal SSH to provide Git protocol and doesn’t support OpenSSH. To install Gitea with Docker (rootless), you need to create a directory for data and config and touch a docker-compose.yml file. Then, you can create a volume and a network and start the gitea/gitea:latest-rootless image as a service. Again, the setup will guide you through the process, and you can customize the installation by configuring environment variables.
Both methods use
docker-compose, so make sure you have that installed.
You will also have to work out a way to get the site live on the web once it's installed.
Hosted Gitea offers an all-in-one solution for getting Gitea online. It doesn't use Docker because Gitea is run directly bringing a slight performance gain. If you are looking for a fully managed Gitea solution this might be the solution for you.