Skip to content

Instantly share code, notes, and snippets.

@dpmex4527
Last active September 5, 2024 10:03
Show Gist options
  • Save dpmex4527/1d702357697162384d31d033a7d505eb to your computer and use it in GitHub Desktop.
Save dpmex4527/1d702357697162384d31d033a7d505eb to your computer and use it in GitHub Desktop.
Set up SVN server on docker

SVN on docker!

Quick notes on setting up a lightweight SVN server that is accessible via http (WebDav) and the svn custom protocol (svn://).

credits to :

Pre-reqs

Steps

This guide uses a lightweight svn-server docker image called elleFlorio/svn-docker. To set up

  • 1 ) Create an svn-root volume to hold your svn-server repos on your docker host

    $ docker volume create svn-root
  • 2 ) Run the docker container and set your working directory to /home/svn

    $ docker run -dit --name svn-server -v svn-root:/home/svn -p 7443:80 -p 3960:3960 -w /home/svn elleflorio/svn-server
  • 3 ) Configure a username and password to access http protocol

    $ docker exec -t svn-server htpasswd -b /etc/subversion/passwd svnadmin <password>
  • 4 ) Verify that the svn services is up and showing 0 repos available

    $ svn info svn://localhost:3960/
    
    svn: E170013: Unable to connect to a repository at URL 'svn://localhost:3960'
    svn: E210005: No repository found in 'svn://localhost:3960'
  • 5 ) Log in to your svn server using URL: http://localhost:7443/svn. You should see an empty listing with "Collection of Repositories" string on top

  • 6 ) Create a test svn repo using svnadmin command. verify repo exsits both in command line and web page

    $ docker exec -it svn-server svnadmin create Test
    $ docker exec -it svn-server ls -al Test
    
    total 16
    drwxr-xr-x   8 primetheus  staff  272 Jun  7 15:22 .
    drwxr-xr-x   3 primetheus  staff  102 Jun  7 15:22 ..
    -rw-r--r--   1 primetheus  staff  246 Jun  7 15:22 README.txt
    drwxr-xr-x   6 primetheus  staff  204 Jun  7 15:22 conf
    drwxr-sr-x  15 primetheus  staff  510 Jun  7 15:22 db
    -r--r--r--   1 primetheus  staff    2 Jun  7 15:22 format
    drwxr-xr-x  11 primetheus  staff  374 Jun  7 15:22 hooks
    drwxr-xr-x   4 primetheus  staff  136 Jun  7 15:22 locks
    $ svn info svn://localhost:3960/Test
    
    Path: Test
    URL: svn://localhost:3960/Test
    Relative URL: ^/
    Repository Root: svn://localhost:3960/Test
    Repository UUID: 626ee621-fc48-49e1-8733-3f850e997e67
    Revision: 0
    Node Kind: directory
    Last Changed Rev: 0
    Last Changed Date: 2017-06-07 15:22:54 -0500 (Wed, 07 Jun 2017)

Load test subversion repo

Let's load a test SVN repository, located here.

  • Dump SVN repo to local Docker container
    $ docker exec -it svn-server sh -c "svnrdump dump https://svn.code.sf.net/p/ultrastardx/svn | gzip > /tmp/ultrastardx.dump.gz"
  • Create new repo to host code
    $ docker exec -it svn-server svnadmin create ultrastardx
  • Load in the SVN dump archive (make sure your dashes and quotes aren't funky here)
    $ docker exec -it svn-server sh -c "gunzip -c /tmp/ultrastardx.dump.gz | svnadmin load ultrastardx"
  • Check to see that repo has been loaded properly
    $ svn info svn://localhost:3960/ultrastardx
@dpmex4527
Copy link
Author

Thanks for the suggestion!

@AlpNek
Copy link

AlpNek commented Apr 22, 2019

docker exec -it mysvn svnadmin create Test succeeds but when running svn info i get:

$ svn info svn://localhost:3960/Test
svn: E170013: Unable to connect to a repository at URL 'svn://localhost:3960/Test'
svn: E210005: No repository found in 'svn://localhost:3960/Test'

Also, after creating the repository, it does not show up on http://localhost/svn page (not sure if it should).

Running this on Ubuntu.

@Tires
Copy link

Tires commented Aug 8, 2019

docker exec -it mysvn svnadmin create Test succeeds but when running svn info i get:

$ svn info svn://localhost:3960/Test
svn: E170013: Unable to connect to a repository at URL 'svn://localhost:3960/Test'
svn: E210005: No repository found in 'svn://localhost:3960/Test'

Also, after creating the repository, it does not show up on http://localhost/svn page (not sure if it should).

Running this on Ubuntu.

Same in my setup (Ubuntu, ENV S6_OVERLAY_VERSION=v1.22.1.0 GO_DNSMASQ_VERSION=1.0.7). Any idea?

@ojvm
Copy link

ojvm commented Aug 30, 2019

Thank for this. i am not been able to complete the steps, when i run svn info svn://localhost:3960/ the console shows

svn: E170013: Unable to connect to a repository at URL 'svn://localhost:3960'
svn: E210002: Network connection closed unexpectedly

tried on macOs mojave

@piliplaker
Copy link

piliplaker commented Sep 3, 2019

@AlpNek @ojvm @Tires ,It seems that the svn server port of the docker image has been changed from 3960 to 3690 somehow. So try this:
docker run -dit --name svn-server -v svn-root:/home/svn -p 7443:80 -p 3690:3690 -w /home/svn elleflorio/svn-server
and type svn info svn://localhost:3690/Test to inspect the demo repo

@Yashika2804
Copy link

Yashika2804 commented Sep 23, 2020

docker exec -it svn-server sh -c "svnrdump dump https://svn.code.sf.net/p/ultrastardx/svn | gzip > /tmp/ultrastardx.dump.gz".
This command keeps loading all revisions forever like
....

  • Dumped revision 760.
  • Dumped revision 761.
  • Dumped revision 762. and goes on.
    How can I skip these revisions? How do I checkout only the last revision ? Please help. I'm not finding any docker image for windows svn.

@TheCrether
Copy link

The path/name for the repository needs to be changed when creating it in order for it to show up in SVN:

docker exec -it svn-server svnadmin create Test
becomes:
docker exec -it svn-server svnadmin create /home/svn/Test

I'm not sure why SVN isn't configured correctly, but after this my repositores showed up and were able to be accessed through the HTTP url:
svn info http://localhost/svn/Test

@bipinacellere
Copy link

Got 2 issues after doing first commit

  • svn commit -m "first commit"
    Solution: docker exec -t svn-server sed -i "s/= r/= rw/g" /etc/subversion/subversion-access-control

  • svn: E000013: Can't open file '/home/svn/Test/db/txn-current-lock': Permission denied
    Solution: docker exec svn-server chown -R apache:apache /home/svn/Test

@heavymevi
Copy link

@bipinacellere thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment