liveBook · Manning

Gogs

As explained in Learn Docker in a Month of Lunches, Second Edition

Gogs is a lightweight, self-hosted web service for hosting and managing Git repositories.

Gogs is an open-source Git server for hosting source code inside a private network. In a containerized build system, it provides source control alongside a Docker registry and Jenkins. section 11.2

A practical Gogs setup follows these steps:

  • Start the infrastructure with Docker Compose, choosing the Linux- or Windows-container override. section 11.2
  • Open the web interface at localhost:3000 and register a user manually. section 11.2
  • Create a Git repository, add it as a local remote, and push source code using the registered credentials. section 11.2
# add registry domain to local hosts file on Mac or Linux:
sudo ./scripts/add-to-hosts.sh registry.local 127.0.0.1
# OR using PowerShell (run as admin)
./scripts/add-to-hosts.ps1 registry.local 127.0.0.1
# switch to infrastructure folder:
cd ch11/exercises/infrastructure
# start the app with Linux containers:
docker compose -f docker-compose.yml -f docker-compose-linux.yml up -d
# OR start with Windows Server containers:
docker compose -f docker-compose.yml -f docker-compose-windows.yml up -d
# check containers:
docker container ls

Use the startup commands to add the local registry hostname, enter the infrastructure directory, launch the correct Compose configuration, and verify running containers. section 11.2

Private build infrastructure

A local setup publishes Gogs on port 3000, Jenkins on port 8080, and a Docker registry on port 5010. Gogs stores application source, Jenkins runs the pipeline, and the registry distributes images. Gogs automates system setup but still requires manual user creation. section 11.2

Hands-on pipeline lab

Build a CI pipeline for the to-do app by creating a Compose build override, creating a Jenkins job, and pushing the changes to the diamol repository in Gogs. Expect to inspect logs and adjust failed builds. section 11.6

How Learn Docker in a Month of Lunches, Second Edition covers it

How deep it goes
Walks through container startup, manual account and repository creation, Git pushing, and integration into a CI pipeline.
Examples
Uses localhost:3000, the diamol repository, Git remote commands, and a to-do application pipeline.
What it assumes
Assumes basic Git and Docker Compose usage while teaching the required local service startup and Gogs web configuration.
What you can do after
Operate Gogs in Docker, create repositories and users, push source code, and connect it to a Jenkins pipeline.
How it connects
Connects Git repositories with Docker Compose, Jenkins, Docker registry workflows, and CI pipelines.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Docker in a Month of Lunches, Second Edition. The section links point to the parts of the book it draws on.