# OneDev

> All-in-one DevOps platform with Git and CI/CD.

- Category: Development Tools
- Difficulty: intermediate
- Components: onedev
- Tags: onedev, git, devops, cicd
- Source: https://docker.recipes/development/onedev

## Overview

OneDev is an all-in-one DevOps platform that combines Git repository management, continuous integration and deployment, code review workflows, issue tracking, and project wikis into a single self-hosted solution. Originally developed as an open-source alternative to platforms like GitLab and GitHub Enterprise, OneDev distinguishes itself by using Kubernetes YAML syntax for pipeline definitions and providing built-in Docker integration for job execution. The platform emphasizes simplicity and performance while offering enterprise-grade features like branch protection rules, service desk functionality, and comprehensive audit logging.

This Docker configuration deploys OneDev as a standalone server with direct access to the host's Docker daemon, enabling it to spawn containers for CI/CD job execution. The setup exposes both HTTP and SSH interfaces, allowing developers to interact with Git repositories through web browsers or command-line tools. OneDev's architecture eliminates the need for separate components like Redis or PostgreSQL by using an embedded database and file-based storage, making it particularly suitable for organizations wanting a complete DevOps solution without complex infrastructure management.

Small to medium-sized development teams, startups seeking cost-effective DevOps tooling, and organizations requiring full control over their source code and CI/CD processes will find this configuration valuable. OneDev excels in environments where teams want GitHub or GitLab-like functionality without vendor lock-in or subscription costs, while maintaining the flexibility to customize workflows and integrate with existing Docker-based development environments.

## Features

- Git repository hosting with advanced branching strategies and merge request workflows
- Kubernetes YAML-based CI/CD pipeline syntax with visual pipeline editor
- Built-in Docker job executor that spawns containers for build and deployment tasks
- Integrated code review system with inline comments and approval workflows
- Service desk functionality for customer support ticket management
- Symbol navigation and code search across repositories with language-aware indexing
- Issue tracking with customizable fields, workflows, and board views
- Built-in package registry for Docker images and Maven artifacts

## Use cases

- Small development teams migrating from GitHub or GitLab to self-hosted solutions
- Startups building Docker-based applications requiring integrated DevOps workflows
- Organizations needing air-gapped development environments with full CI/CD capabilities
- Educational institutions teaching DevOps practices with hands-on Git and pipeline management
- Open source projects requiring comprehensive code review and contributor management
- Companies consolidating multiple DevOps tools into a single platform to reduce complexity
- Development teams practicing trunk-based development with automated testing pipelines

## Prerequisites

- Minimum 4GB RAM recommended for OneDev server with active CI/CD pipelines
- Docker daemon access required for job execution (Docker socket mounted)
- Available ports 6610 (HTTP) and 6611 (SSH Git) for external access
- At least 20GB disk space for repositories, build artifacts, and Docker images
- Basic understanding of Kubernetes YAML syntax for pipeline configuration
- Knowledge of Git workflows and branching strategies for team collaboration

## docker-compose.yml

```yaml
services:
  onedev:
    image: 1dev/server:latest
    container_name: onedev
    restart: unless-stopped
    volumes:
      - onedev_data:/opt/onedev
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - "6610:6610"
      - "6611:6611"

volumes:
  onedev_data:
```

## .env

```bash
# Configure via web interface
```

## Usage notes

- Docs: https://docs.onedev.io/
- Access at http://localhost:6610 - create admin on first visit
- Port 6611 for SSH git operations
- Built-in CI/CD runs jobs in Docker containers
- Code review, issue tracking, and wiki included
- Kubernetes YAML pipeline syntax (different from GitLab)

## Troubleshooting

- Permission denied accessing Docker socket: Ensure OneDev container runs with proper Docker group permissions or use Docker-in-Docker setup
- SSH Git clone fails on port 6611: Verify SSH key configuration in OneDev user settings and check firewall rules
- Build jobs fail with resource constraints: Increase Docker daemon memory limits or configure job resource quotas in OneDev settings
- OneDev web interface returns 502 errors: Check container logs for database corruption and verify volume permissions for onedev_data
- Pipeline jobs stuck in pending status: Restart OneDev container to reset job executor and check Docker daemon connectivity

