美文网首页【原创】Docker实战系列
Docker部署应用-SVN服务器安装

Docker部署应用-SVN服务器安装

作者: 复苏的兵马俑 | 来源:发表于2020-04-21 15:17 被阅读0次

1、前置准备

   1)CentOS 8.0 图形化安装
   2)CentOS 8.0 基本配置
   3)CentOS 8.0 创建LVM分区
   4)CentOS 8.1 安装Docker

2、拉取SVN镜像

[root@Server ~]# docker image ls -a
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
nginx               1.17.10             e791337790a6        3 days ago          127MB
[root@Server ~]# docker image pull elleflorio/svn-server
Using default tag: latest
latest: Pulling from elleflorio/svn-server
6f821164d5b7: Pull complete
53147f26e808: Pull complete
7e80baa778d5: Pull complete
c54880b9f66e: Pull complete
4230cfb273d1: Pull complete
ce33c2e60945: Pull complete
4e6de7ab0a11: Pull complete
941cee5af346: Pull complete
339764134077: Pull complete
9f19e1ee8176: Pull complete
e73a5004078c: Pull complete
Digest: sha256:678ed496b0af421fbcc5720befb5b385f7eabe8198c4c753e59b0723f2090375
Status: Downloaded newer image for elleflorio/svn-server:latest
docker.io/elleflorio/svn-server:latest
[root@Server ~]# docker image ls -a
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
nginx                   1.17.10             e791337790a6        3 days ago          127MB
elleflorio/svn-server   latest              8cc13133f6ed        3 months ago        49.7MB

3、运行临时容器

[root@Server ~]# docker container ls -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES
8e81c9b12c64        nginx:1.17.10       "nginx -g 'daemon of…"   32 minutes ago      Up 32 minutes       0.0.0.0:8000->80/tcp   nginxsrv
[root@Server ~]# docker run -d --name test elleflorio/svn-server:latest
b91ac8038e90b2206a5b19cebf62fe0bbaf3620e63f6abd77446504cfb0e6a28
[root@Server ~]# docker container ls -a
CONTAINER ID        IMAGE                          COMMAND                  CREATED             STATUS              PORTS                       NAMES
b91ac8038e90        elleflorio/svn-server:latest   "/init"                  17 seconds ago      Up 17 seconds       80/tcp, 443/tcp, 3690/tcp   test
8e81c9b12c64        nginx:1.17.10                  "nginx -g 'daemon of…"   44 minutes ago      Up 44 minutes       0.0.0.0:8000->80/tcp        nginxsrv

4、复制容器文件

[root@Server ~]# mkdir -p /data/svn/conf.d
[root@Server ~]# docker container cp test:/etc/subversion/passwd /data/svn/conf.d
[root@Server ~]# docker container cp test:/etc/subversion/subversion-access-control /data/svn/conf.d
[root@Server ~]# ls -l /data/svn/conf.d
total 0
-rw-rw-rw- 1 root root    0 Jan  3 04:55 passwd
-rw-rw-rw- 1 root root   20 Jan  3 04:55 subversion-access-control

5、删除临时容器

[root@Server ~]# docker container ls -a
CONTAINER ID        IMAGE                          COMMAND                  CREATED             STATUS              PORTS                       NAMES
b91ac8038e90        elleflorio/svn-server:latest   "/init"                  2 minutes ago       Up 2 minutes        80/tcp, 443/tcp, 3690/tcp   test
8e81c9b12c64        nginx:1.17.10                  "nginx -g 'daemon of…"   47 minutes ago      Up 47 minutes       0.0.0.0:8000->80/tcp        nginxsrv
[root@Server ~]# docker container rm -f test
test
[root@Server ~]# docker container ls -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES
8e81c9b12c64        nginx:1.17.10       "nginx -g 'daemon of…"   47 minutes ago      Up 47 minutes       0.0.0.0:8000->80/tcp   nginxsrv

6、运行正式容器

[root@Server ~]# docker container ls -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES
8e81c9b12c64        nginx:1.17.10       "nginx -g 'daemon of…"   47 minutes ago      Up 47 minutes       0.0.0.0:8000->80/tcp   nginxsrv
[root@Server ~]# docker run -d -p 3690:3690 -p 8001:80 \
> --name svnsrv \
> -v /data/svn/repository:/home/svn \
> -v /data/svn/conf.d/:/etc/subversion/ \
> -v /data/svn/html:/run/apache2 \
> -v /data/nginx/html/:/home/nginx/html \
> -v /data/apache/www/:/home/apache/www \
> -v /data/nginx/html/:/home/nginx/html \
> --privileged=true --restart=always \
> -e SVN_REPONAME=repos elleflorio/svn-server:latest
b573bedbb67c85d7dde91eea3eb8e81ac59b4bbb62577ad2d032f4898f725f00
[root@Server ~]# docker container ls -a
CONTAINER ID        IMAGE                          COMMAND                  CREATED             STATUS              PORTS                                                   NAMES
bf9d05430205        elleflorio/svn-server:latest   "/init"                  20 seconds ago      Up 19 seconds       443/tcp, 0.0.0.0:3690->3690/tcp, 0.0.0.0:8001->80/tcp   svnsrv
8e81c9b12c64        nginx:1.17.10                  "nginx -g 'daemon of…"   2 hours ago         Up 2 hours          0.0.0.0:8000->80/tcp                                    nginxsrv

7、初始化配置并验证

   A)设置svn账号和密码

[root@Server ~]# docker container exec -t svnsrv htpasswd -b /etc/subversion/passwd admin 1qaz@WSX
Adding password for user admin
[root@Server ~]# cat /data/svn/conf.d/passwd
admin:$apr1$wjHYU4V6$wcKbjVY28tYbjNej25/Sl/

   B)配置iF.SVNAdmin

[root@Server ~]# docker exec -t svnsrv chmod -R o+rw /home/svn

   C)额外配置

[root@Server ~]# docker exec -t svnsrv chmod -R o+rw /home/apache/www
[root@Server ~]# docker exec -t svnsrv chmod -R o+rw /home/nginx/html

相关文章

网友评论

    本文标题:Docker部署应用-SVN服务器安装

    本文链接:https://www.haomeiwen.com/subject/yvsuihtx.html