Gogs
Painless self-hosted Git service.
Overview
Gogs is a self-hosted Git service written in Go that provides a lightweight alternative to GitHub, GitLab, and other Git hosting platforms. Created in 2014 by Unknwon, Gogs was designed with simplicity and minimal resource consumption in mind, making it ideal for individuals, small teams, and organizations who want complete control over their Git repositories without the overhead of more complex solutions. The name 'Gogs' stands for 'Go Git Service' and emphasizes its focus on being painless to deploy and maintain.
This Docker stack deploys Gogs as a single-container solution that includes both the web interface and SSH Git access capabilities. The configuration exposes the standard HTTP port 3000 for web-based repository management and port 222 for SSH operations, allowing developers to clone, push, and pull repositories using standard Git commands. Gogs uses SQLite as its default database, which means the entire Git service runs without external database dependencies while maintaining all data in a single volume.
This setup is perfect for developers who need a private Git hosting solution, small development teams requiring collaborative coding environments, or homelab enthusiasts wanting to self-host their code repositories. Unlike heavier alternatives, Gogs can run comfortably on Raspberry Pi devices and low-resource VPS instances while still providing essential Git hosting features like issue tracking, pull requests, and user management.
Key Features
- Built-in SQLite database requiring no external database server or configuration
- SSH Git access on custom port 222 for secure repository operations
- Web-based repository browser with syntax highlighting for 100+ programming languages
- Issue tracking system with labels, milestones, and assignee management
- Pull request workflow with merge conflict detection and resolution
- User and organization management with fine-grained repository permissions
- Git hook support for custom automation and CI/CD integration
- Repository mirroring for backing up external Git repositories
Common Use Cases
- 1Small software development teams needing private Git repositories with collaboration features
- 2Individual developers wanting to host personal projects with professional Git workflow tools
- 3Educational institutions providing students with hands-on Git hosting experience
- 4Homelab enthusiasts building self-hosted development environments
- 5Companies requiring on-premises source code hosting for compliance or security reasons
- 6Open source projects needing lightweight hosting with issue tracking and pull requests
- 7Development teams migrating from hosted Git services to self-hosted solutions
Prerequisites
- Docker and Docker Compose installed on the host system
- Minimum 512MB RAM available for the Gogs container
- Ports 3000 and 222 available and not used by other services
- At least 1GB free disk space for initial setup and repository storage
- Basic understanding of Git operations and SSH key management
- Network access for users who will clone repositories via SSH or HTTPS
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 gogs: 3 image: gogs/gogs:latest4 container_name: gogs5 restart: unless-stopped6 volumes: 7 - gogs_data:/data8 ports: 9 - "3000:3000"10 - "222:22"1112volumes: 13 gogs_data: .env Template
.env
1# Configuration via web installerUsage Notes
- 1Docs: https://gogs.io/docs
- 2Access at http://localhost:3000 - setup wizard on first visit
- 3SSH on port 222 for git clone operations
- 4Uses SQLite by default (easy single-file backup)
- 5Extremely lightweight - runs on minimal resources
- 6Similar to Gitea (Gitea forked from Gogs)
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 gogs:5 image: gogs/gogs:latest6 container_name: gogs7 restart: unless-stopped8 volumes:9 - gogs_data:/data10 ports:11 - "3000:3000"12 - "222:22"1314volumes:15 gogs_data:16EOF1718# 2. Create the .env file19cat > .env << 'EOF'20# Configuration via web installer21EOF2223# 3. Start the services24docker compose up -d2526# 4. View logs27docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/gogs/run | bashTroubleshooting
- SSH clone fails with connection refused: Ensure port 222 is open in firewall and SSH key is properly configured in Gogs user settings
- Installation wizard shows database error: Check that gogs_data volume has proper write permissions and sufficient disk space
- Web interface returns 502 bad gateway: Verify container is running with 'docker logs gogs' and restart if necessary
- Git push fails with permission denied: Confirm the repository owner has granted push access and SSH key is added to user account
- Gogs web UI loads but repositories don't appear: Check volume mount is persistent and SQLite database file exists in /data directory
- Cannot access admin panel after setup: Default admin user must be created during initial setup wizard or via command line in container
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Ad Space
Shortcuts: C CopyF FavoriteD Download