1 安装

docker pull paulovsm/svn-server

2 运行

docker run --name svn -p 8082:80  -v /home/svn:/home/svn  -d paulovsm/svn-server

3 访问:

svn:    http://xxx:8082/svnadmin

svnadmin:   http://xxx:8082/svnadmin

4 进入容器

docker exec -it svn bash

docker容器中安装vi命令

apt-get update
命令的作用是:同步 /etc/apt/sources.list 和 /etc/apt/sources.list.d 中列出的源的索引,这样才能获取到最新的软件包。

apt-get install vim
修改配置

[root@iZuf6boi8ejfovwda7q1ynZ svn]# docker exec -it svn bash
root@d54dc86dc03a:/# cd /var/www/svnadmin/data                                                                                                                                                                
root@d54dc86dc03a:/var/www/svnadmin/data# vi config.ini
[Common]
FirstStart=0
BackupFolder=./data/backup/

[Translation]
Directory=./translations/

[Engine:Providers]
AuthenticationStatus=basic
UserViewProviderType=passwd
UserEditProviderType=passwd
GroupViewProviderType=svnauthfile
GroupEditProviderType=svnauthfile
AccessPathViewProviderType=svnauthfile
AccessPathEditProviderType=svnauthfile
RepositoryViewProviderType=svnclient
RepositoryEditProviderType=svnclient

[ACLManager]
UserRoleAssignmentFile=./data/userroleassignments.ini

[Subversion]
#SVNAuthFile=/etc/subversion/authz.conf
SVNAuthFile=/home/svn/svnconfig/accessfile
[Repositories:svnclient]
SVNParentPath=/home/svn/data
SvnExecutable=/usr/bin/svn
SvnAdminExecutable=/usr/bin/svnadmin

[Users:passwd]
SVNUserFile=/home/svn/svnconfig/passwdfile

[Users:digest]
SVNUserDigestFile=
SVNDigestRealm=SVN Privat
保存,重新运行容器

6 提交修改容器

[root@iZuf6boi8ejfovwda7q1ynZ svn]# docker commit -m "svn & svnadmin" -a "svn-svnadmin" d54dc86dc03a sohudo/svn-svnadmin:latest
sha256:3c879974b8c17704fdb96965a18649e41e3fc9f36c6867207d494067e06c5e29
[root@iZuf6boi8ejfovwda7q1ynZ svn]# docker images
REPOSITORY                      TAG                 IMAGE ID            CREATED             SIZE
sohudo/svn-svnadmin             latest              3c879974b8c1        20 seconds ago      311.8 MB
docker.io/paulovsm/svn-server   latest              2d7d81d37ff2        2 years ago         256.4 MB

7 运行新的容器

[root@iZuf6boi8ejfovwda7q1ynZ svn]# docker run --name svnadmin -p 8088:80  -v /home/svn:/home/svn  -d sohudo/svn-svnadmin
e48266d60e1da526278d946fdbf24a728ece6d00c3735b031513cd35bf5ccd25
[root@iZuf6boi8ejfovwda7q1ynZ svn]# docker ps
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS                 PORTS                                                             NAMES
e48266d60e1d        sohudo/svn-svnadmin          "./startup.sh"           5 seconds ago       Up 4 seconds           0.0.0.0:8088->80/tcp                                              svnadmin
d54dc86dc03a        paulovsm/svn-server          "./startup.sh"           9 days ago          Up About an hour       0.0.0.0:8082->80/tcp                                              svn
    进入容器 设置目录权限  chmod -R 777 ./svn

svnadmin密码9EOjBreLZk

8:docker login

[root@iZuf6boi8ejfovwda7q1ynZ ~]# docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: sohudo
Password: 
Login Succeeded


9:docker push 

docker push sohudo/svn-svnadmin
The push refers to a repository [docker.io/sohudo/svn-svnadmin]
508c08da5368: Pushed 
5f70bf18a086: Pushed 
latest: digest: sha256:dc37a7099d252a368cbc5280180aee04e4d30cfba7870e6ed1fde9da8d34563b size: 9874








Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐