# Run Apache Subversion Containerized in Docker
Author: i12bretro
Keywords: Browser Based,Docker Made Easy,Home Lab,Home Lab Ideas,Install Guide,Version Control,Ubuntu,Subversion,Source Control,Source Code,Source Code Tracking,SVN Server,SVN,Repository,Linux,Code Repository,Apache Subversion,Docker Simplified,Docker Made Simple,Homelab,Docker Container,Docker How To,Docker Tutorial,How To,Tutorial,i12bretro

## What is Subversion?

> Subversion exists to be universally recognized and adopted as an open-source, centralized version control system characterized by its reliability as a safe haven for valuable data; the simplicity of its model and usage; and its ability to support the needs of a wide variety of users and projects, from individuals to large-scale enterprise operations. -https://subversion.apache.org/

## Installing Docker

1. Log into the Linux based device
2. Run the following commands in the terminal
   # install prerequisites
   sudo apt install apt-transport-https ca-certificates git curl software-properties-common gnupg-agent -y
   # add docker gpg key
   curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -
   # add docker software repository
   sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"
   # install docker
   sudo apt install docker-ce docker-compose containerd.io -y
   # enable and start docker service
   sudo systemctl enable docker && sudo systemctl start docker
   # add the current user to the docker group
   sudo usermod -aG docker $USER
   # reauthenticate for the new group membership to take effect
   su - $USER

## Running Subversion

1. Now that Docker is installed, run the following commands to setup the Subversion Docker container and run it
   # create repository directory
   mkdir ~/docker/subversion/repos -p
   # run subversion container
   docker run -d --name=subversion -p 8080:80 -p 3690:3690 -v ~/docker/subversion/repos:/data/svn -e SVN_LOCAL_ADMIN_USER=admin -e SVN_LOCAL_ADMIN_PASS=SomethingSecure --restart=unless-stopped iaean/subversion
2. Open a web browser and navigate to http://DNSorIP:8080
3. Login with the credentials set with the SVN_LOCAL_ADMIN_USER and SVN_LOCAL_ADMIN_PASS environment variables
4. Open a new browser tab and navigate to http://DNSorIP:8080/websvn
5. Welcome to Subversion running in Docker

## Create a New Repository

1. With Subversion running, continue with the following commands to create a new code repository
   # create a repository called demorepo
   docker exec -it subversion /usr/bin/svnadmin create /data/svn/sandbox/demorepo
2. Back in the browser refresh WebSVN to see the new repository

Source: https://github.com/iaean/docker-subversion