A secure and optimized Subversion (SVN) server, containerized with Docker and based on Ubuntu 24.04.
This Docker image provides a complete and secure SVN server ready for production. It encapsulates Apache Subversion 1.14.3 in an optimized Ubuntu 24.04 container with enhanced security configuration.
The image works according to this architecture:
βββββββββββββββββββββββββββββββββββββββββ
β Docker Container β
β ββββββββββββββββββββββββββββββββββββ β
β β Ubuntu 24.04 LTS β β
β β βββββββββββββββββββββββββββββββ β β
β β β Apache Subversion β β β
β β β 1.14.3 β β β
β β βββββββββββββββββββββββββββββββ β β
β β βββββββββββββββββββββββββββββββ β β
β β β 'svn' User β β β
β β β (non-root, secure) β β β
β β βββββββββββββββββββββββββββββββ β β
β ββββββββββββββββββββββββββββββββββββ β
β Port 3690 (SVN Protocol) β
βββββββββββββββββββββββββββββββββββββββββ
- Complete SVN server with Apache Subversion 1.14.3
- SVN protocol support: Native SVN protocol (port 3690) for repository access
- Multi-architecture support: AMD64 and ARM64 platforms
- Enhanced security: dedicated user, restrictive permissions, secure configuration
- Flexible configuration: externalized configuration files with automatic seeding
- Health monitoring: built-in healthcheck for SVN service
- Optimized image: based on Ubuntu 24.04, reduced size
- Production ready: integrated security and efficiency scans
The image uses Ubuntu 24.04 LTS as base, ensuring stability and long-term support.
The image is built for multiple architectures:
- linux/amd64: Intel/AMD 64-bit processors
- linux/arm64: ARM 64-bit processors (Apple Silicon, ARM servers)
RUN apt-get update && \
apt-get install -y --no-install-recommends subversion=1.14.3-1build4# Remove default ubuntu user and reuse its UID/GID
deluser --remove-home ubuntu && \
addgroup --system --gid ${APP_GID} svn && \
adduser --system --uid ${APP_UID} --home ${HOME_DIR} --no-create-home --ingroup svn svn- User Management: Reuses UID/GID 1000 from removed ubuntu user
- Directory Permissions:
/home/svnwith 755 permissions (svn:svn ownership) - Security Hardening: Configuration files with restricted access
- Bash Configuration: Custom shell setup for svn user
./scripts/install_tools.shModify the manifest.yaml file according to your needs:
name: svn_server_docker
tags:
- latest
registry: ghcr.io/deerhide/svn_server_docker
build:
format: oci
args:
- APP_UID=1000
- UBUNTU_VERSION=24.04# Connect to GitHub Container Registry
# Use the provided script for docker:
./scripts/login_docker.sh
# Or for skopeo:
./scripts/login_skopeo.sh./scripts/builder.shThe script performs:
- β Multi-architecture image builds using Buildah (AMD64 + ARM64)
- β Saves per-arch images as tar archives for analysis
- β Filesystem efficiency scans with Dive for each architecture
- β Pushes per-arch images to the registry with Skopeo
- β Creates and pushes a multi-arch manifest (Docker manifest)
Notes:
- Hadolint validation is available but disabled by default in the script
(uncomment in
scripts/builder.shto enable). - Trivy vulnerability scanning is installed via
./scripts/install_tools.shbut disabled by default in the build script (uncomment to enable).
docker run -d \
--name svn-server \
-p 3690:3690 \
-v svn-data:/home/svn \
ghcr.io/deerhide/svn_server_docker:latestThe project includes a docker-compose.yaml file for easy testing and development:
# Start the SVN server
docker-compose up -d
# View logs
docker-compose logs -f
# Stop the server
docker-compose downEnvironment Variables:
HOME_DIR: Override the home directory path (default:/home/svn)
docker run -d \
--name svn-server \
-p 3690:3690 \
-v svn-data:/home/svn \
-v ./custom-config:/etc/subversion \
ghcr.io/deerhide/svn_server_docker:latestAccess repositories using the native SVN protocol:
# Clone a repository via SVN protocol
svn checkout svn://localhost:3690/hello
# Or using full path
svn checkout svn://localhost:3690/home/svn/helloSVN Protocol Configuration:
- Port: 3690
- Authentication: SVN built-in authentication (username/password)
- Protocol: Native SVN protocol for optimal performance
svn_server_docker/
βββ Containerfile # Docker image definition
βββ manifest.yaml # Build configuration
βββ docker-compose.yaml # Docker Compose orchestration
βββ src/ # Source configuration files
β βββ subversion/ # SVN configuration templates
β βββ svnserve.conf # SVN server configuration
β βββ passwd # Users file template
βββ scripts/ # Utility scripts
β βββ builder.sh # Main build script
β βββ entrypoint.sh # Container entrypoint script
β βββ healthcheck.sh # Health monitoring script
β βββ install_tools.sh # Dependencies installation
β βββ launch.sh # Development launch helper
β βββ lib_utils.sh # Utility functions
β βββ login_docker.sh # Docker authentication
β βββ login_skopeo.sh # Skopeo authentication
βββ README.md # This file
[general]
anon-access = none # No anonymous access
auth-access = write # Write access for authenticated users
password-db = /etc/subversion/passwd # Password file
realm = SVN Server # Authentication realm name[users]
# name = password
admin = password123
user1 = another_passwordDocker Compose Configuration:
- Ports: 3690 (SVN protocol)
- Volumes:
./svn_data:/home/svn(SVN repositories)./svn_config:/etc/subversion(SVN configuration)
- Build: Uses local
Containerfilefor development - Health Check: Built-in health monitoring for SVN service
Note: The ./svn_data directory can be prepared automatically with correct permissions (1000:1000) by running ./scripts/launch.sh.
Development Commands:
# Start development environment
docker-compose up -d
# Check container status and health
docker-compose ps
# View real-time logs
docker-compose logs -f svn
# Access container shell
docker-compose exec svn bash
# Test SVN access via protocol
svn checkout svn://localhost:3690/hello
# Stop and clean up
docker-compose downFor SVN Protocol Access:
- Modify the
svn_config/passwdfile (runtime configuration) - Restart the container:
docker-compose restart
Runtime Configuration (Recommended):
- Modify files in
svn_config/directory - Restart the container:
docker-compose restart
Build-time Configuration:
- Modify files in
src/subversion/ - Rebuild the image:
./scripts/builder.sh
- Non-root user (
svn): the image doesn't run as root - Restrictive permissions: configuration files are protected
- Automatic vulnerability scans: Trivy integration
- Ubuntu 24.04 LTS base: long-term support and security updates
The container includes built-in health monitoring for the SVN service:
# Check container health status
docker ps
# Look for "healthy" status in the STATUS column
# Manual health check
docker exec svn-server /usr/local/bin/healthcheck.sh
# Health check details
docker inspect svn-server | jq '.[0].State.Health'Health Check Configuration:
- Interval: 30 seconds
- Timeout: 5 seconds
- Retries: 3 attempts
- Checks: SVN service (port 3690)
# Container logs
docker logs svn-server
# Follow logs in real-time
docker logs -f svn-server
# Docker Compose logs
docker-compose logs -f svn# SVN server logs
docker exec svn-server cat /var/log/svn/svnserve.log
# System logs
docker exec svn-server journalctl -fBuild arguments are defined in manifest.yaml and passed by the builder script:
# User UID (default: 1000)
APP_UID=1000
# Group GID (default: 1000)
APP_GID=1000
# Ubuntu version (default: 24.04)
UBUNTU_VERSION=24.04# SVN Repository Configuration
SVN_REPO_NAME=my_repo
SVN_REPO_PATH=/home/svn/${SVN_REPO_NAME}
SVN_REPO_URL=file://${SVN_REPO_PATH}- CPU: 1 core minimum
- RAM: 512 MB minimum
- Storage: 10 GB minimum (depending on repository size)
- Initialization: Container starts with
svnuser - Configuration: Loading configuration files from
/etc/subversion/ - Service startup: Launching
svnservein daemon mode - Listening: Server listens on port 3690 for SVN connections
SVN Client β Port 3690 β svnserve β Repositories in /home/svn
- Location: All repositories are stored in
/home/svn - Permissions: Owner
svn:svn(UID:GID 1000:1000) with 755 permissions - Persistence: Use Docker volumes for data persistence
- User Management: Reuses UID/GID from removed ubuntu user for consistency
- Volume Mounts: Automatic permission correction for mounted volumes
- User Consistency: UID/GID 1000:1000 matches common host user permissions
- Security: Non-root user with restricted access to configuration files
When mounting volumes to /home/svn, ensure the host directory has correct permissions:
# Create directory with correct ownership
sudo mkdir -p /path/to/svn-data
sudo chown -R 1000:1000 /path/to/svn-data
sudo chmod -R 755 /path/to/svn-data
# Or using Ansible
- name: Create SVN data directory
ansible.builtin.file:
name: path/to/data
state: directory
mode: "755"
owner: "1000"
group: "1000"
recurse: trueImportant: The container runs as UID:GID 1000:1000, so mounted volumes must have matching ownership to avoid permission issues.
This project is licensed under the MIT License. See the LICENSE file for more details.
Contributions are welcome! Feel free to:
- Fork the project
- Create a branch for your feature
- Commit your changes
- Push to the branch
- Open a Pull Request
For any questions or issues:
- Open an issue on GitHub
- Check Subversion documentation
- Check container logs
Note: This project is an optimized Docker container template for Subversion servers. It follows security and efficiency best practices.