美文网首页【原创】Docker实战系列
Docker管理-基于CentOS通过Dockerfile制作S

Docker管理-基于CentOS通过Dockerfile制作S

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

    1、创建Dockerfile文件

    [root@Server ~]# mkdir /usr/dockerfile
    
    [root@Server ~]# cd /usr/dockerfile/
    
    [root@Server dockerfile]# vi Dockerfile
    # CentOS-8.1.1911-SVN
    FROM centos:8.1.1911
    
    # 安装并配置subversion
    RUN yum -y update && yum install -y subversion && mkdir -p /usr/svn/repository && svnadmin create /usr/svn/repository && chmod -R 775 /usr/svn/repository/db && cd /usr/svn/repository/conf/ && sed -i -e 's/# anon-access = read/anon-access = none/g' -e 's/# auth-access = write/auth-access = write/g' -e 's/# password-db = passwd/password-db = passwd/g' -e 's/# authz-db = authz/authz-db = authz/g' -e 's/# realm = My First Repository/realm = repository/g' ./svnserve.conf && sed -i '$a\admin = 1qaz@WSX' ./passwd && sed -i -e '$a\admin = admin' -e '$a\[repository:/]' -e '$a\@admin = rw' ./authz
    
    # 安装并配置ssh
    RUN yum install -y openssh-server && sed -i -e 's/#LoginGraceTime 2m/LoginGraceTime 2m/g' -e 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' -e 's/#StrictModes yes/StrictModes yes/g' /etc/ssh/sshd_config && mkdir /var/run/sshd && echo 'UseDNS no' >> /etc/ssh/sshd_config && sed -i -e '/pam_loginuid.so/d' /etc/pam.d/sshd && echo 'root:1qaz@WSX' | chpasswd && /usr/bin/ssh-keygen -A
    
    # 复制init.sh文件复制到/usr/svn/
    COPY init.sh /usr/svn/
    
    # 声明svnserve的服务端口
    EXPOSE 3690
    
    # 容器启动时执行"/bin/bash /usr/svn/init.sh"
    CMD ["/bin/bash","/usr/svn/init.sh"]
    

    2、使用Dockerfile构建镜像

    [root@Server dockerfile]# vi init.sh
    #!/bin/bash
    /usr/bin/svnserve -d -r /usr/svn/
    /usr/sbin/sshd -D
    
    [root@Server dockerfile]# ls -l
    total 8
    -rw-r--r-- 1 root root 1266 Apr 19 14:25 Dockerfile
    -rw-r--r-- 1 root root   67 Apr 19 14:26 init.sh
    
    [root@Server dockerfile]# docker image ls -a
    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    
    [root@Server dockerfile]# docker build -t "kevin/svnsrv:1.13.0" .
    Sending build context to Docker daemon  4.096kB
    Step 1/6 : FROM centos:8.1.1911
    8.1.1911: Pulling from library/centos
    8a29a15cefae: Pull complete
    Digest: sha256:fe8d824220415eed5477b63addf40fb06c3b049404242b31982106ac204f6700
    Status: Downloaded newer image for centos:8.1.1911
     ---> 470671670cac
    Step 2/6 : RUN yum -y update && yum install -y subversion && mkdir -p /usr/svn/repository && svnadmin create /usr/svn/repository && chmod -R 775 /usr/svn/repository/db && cd /usr/svn/repository/conf/ && sed -i -e 's/# anon-access = read/anon-access = none/g' -e 's/# auth-access = write/auth-access = write/g' -e 's/# password-db = passwd/password-db = passwd/g' -e 's/# authz-db = authz/authz-db = authz/g' -e 's/# realm = My First Repository/realm = repository/g' ./svnserve.conf && sed -i '$a\admin = 1qaz@WSX' ./passwd && sed -i -e '$a\admin = admin' -e '$a\[repository:/]' -e '$a\@admin = rw' ./authz
     ---> Running in 50105d860dc9
    CentOS-8 - AppStream                            2.5 MB/s | 6.8 MB     00:02
    CentOS-8 - Base                                 2.8 MB/s | 6.0 MB     00:02
    CentOS-8 - Extras                               399  B/s | 5.5 kB     00:14
    Dependencies resolved.
    ================================================================================
     Package                Arch   Version                          Repo       Size
    ================================================================================
    Upgrading:
     audit-libs             x86_64 3.0-0.13.20190507gitf58ec40.el8  BaseOS    116 k
     binutils               x86_64 2.30-58.el8_1.2                  BaseOS    5.7 M
     centos-gpg-keys        noarch 8.1-1.1911.0.9.el8               BaseOS     12 k
     centos-release         x86_64 8.1-1.1911.0.9.el8               BaseOS     21 k
     centos-repos           x86_64 8.1-1.1911.0.9.el8               BaseOS     13 k
     coreutils-single       x86_64 8.30-6.el8_1.1                   BaseOS    630 k
     glibc                  x86_64 2.28-72.el8_1.1                  BaseOS    3.7 M
     glibc-common           x86_64 2.28-72.el8_1.1                  BaseOS    836 k
     glibc-minimal-langpack x86_64 2.28-72.el8_1.1                  BaseOS     48 k
     kexec-tools            x86_64 2.0.19-12.el8_1.2                BaseOS    482 k
     libarchive             x86_64 3.3.2-8.el8_1                    BaseOS    359 k
     openldap               x86_64 2.4.46-11.el8_1                  BaseOS    352 k
     openssl-libs           x86_64 1:1.1.1c-2.el8_1.1               BaseOS    1.5 M
     python3-rpm            x86_64 4.14.2-26.el8_1                  BaseOS    156 k
     rpm                    x86_64 4.14.2-26.el8_1                  BaseOS    539 k
     rpm-build-libs         x86_64 4.14.2-26.el8_1                  BaseOS    153 k
     rpm-libs               x86_64 4.14.2-26.el8_1                  BaseOS    336 k
     sqlite-libs            x86_64 3.26.0-4.el8_1                   BaseOS    579 k
     systemd                x86_64 239-18.el8_1.5                   BaseOS    3.5 M
     systemd-libs           x86_64 239-18.el8_1.5                   BaseOS    562 k
     systemd-pam            x86_64 239-18.el8_1.5                   BaseOS    232 k
     systemd-udev           x86_64 239-18.el8_1.5                   BaseOS    1.3 M
    Installing dependencies:
     xkeyboard-config       noarch 2.24-3.el8                       AppStream 828 k
     kbd-legacy             noarch 2.0.4-8.el8                      BaseOS    481 k
     kbd-misc               noarch 2.0.4-8.el8                      BaseOS    1.4 M
     openssl                x86_64 1:1.1.1c-2.el8_1.1               BaseOS    686 k
    Installing weak dependencies:
     libxkbcommon           x86_64 0.8.2-1.el8                      AppStream 116 k
     diffutils              x86_64 3.6-5.el8                        BaseOS    359 k
     glibc-langpack-en      x86_64 2.28-72.el8_1.1                  BaseOS    818 k
     kbd                    x86_64 2.0.4-8.el8                      BaseOS    392 k
     openssl-pkcs11         x86_64 0.4.8-2.el8                      BaseOS     64 k
    
    Transaction Summary
    ================================================================================
    Install   9 Packages
    Upgrade  22 Packages
    
    Total download size: 26 M
    Downloading Packages:
    (1/31): libxkbcommon-0.8.2-1.el8.x86_64.rpm     326 kB/s | 116 kB     00:00
    (2/31): xkeyboard-config-2.24-3.el8.noarch.rpm  1.9 MB/s | 828 kB     00:00
    (3/31): diffutils-3.6-5.el8.x86_64.rpm          652 kB/s | 359 kB     00:00
    (4/31): glibc-langpack-en-2.28-72.el8_1.1.x86_6 1.1 MB/s | 818 kB     00:00
    (5/31): kbd-legacy-2.0.4-8.el8.noarch.rpm       887 kB/s | 481 kB     00:00
    (6/31): kbd-2.0.4-8.el8.x86_64.rpm              415 kB/s | 392 kB     00:00
    (7/31): openssl-1.1.1c-2.el8_1.1.x86_64.rpm     1.2 MB/s | 686 kB     00:00
    (8/31): openssl-pkcs11-0.4.8-2.el8.x86_64.rpm   202 kB/s |  64 kB     00:00
    (9/31): kbd-misc-2.0.4-8.el8.noarch.rpm         2.2 MB/s | 1.4 MB     00:00
    (10/31): centos-gpg-keys-8.1-1.1911.0.9.el8.noa  86 kB/s |  12 kB     00:00
    (11/31): audit-libs-3.0-0.13.20190507gitf58ec40 298 kB/s | 116 kB     00:00
    (12/31): centos-release-8.1-1.1911.0.9.el8.x86_  98 kB/s |  21 kB     00:00
    (13/31): centos-repos-8.1-1.1911.0.9.el8.x86_64  96 kB/s |  13 kB     00:00
    (14/31): binutils-2.30-58.el8_1.2.x86_64.rpm    3.2 MB/s | 5.7 MB     00:01
    (15/31): glibc-common-2.28-72.el8_1.1.x86_64.rp 1.4 MB/s | 836 kB     00:00
    (16/31): coreutils-single-8.30-6.el8_1.1.x86_64 310 kB/s | 630 kB     00:02
    (17/31): glibc-minimal-langpack-2.28-72.el8_1.1 175 kB/s |  48 kB     00:00
    (18/31): kexec-tools-2.0.19-12.el8_1.2.x86_64.r 412 kB/s | 482 kB     00:01
    (19/31): glibc-2.28-72.el8_1.1.x86_64.rpm       1.1 MB/s | 3.7 MB     00:03
    (20/31): openldap-2.4.46-11.el8_1.x86_64.rpm    572 kB/s | 352 kB     00:00
    (21/31): libarchive-3.3.2-8.el8_1.x86_64.rpm    196 kB/s | 359 kB     00:01
    (22/31): python3-rpm-4.14.2-26.el8_1.x86_64.rpm 375 kB/s | 156 kB     00:00
    (23/31): openssl-libs-1.1.1c-2.el8_1.1.x86_64.r 1.7 MB/s | 1.5 MB     00:00
    (24/31): rpm-4.14.2-26.el8_1.x86_64.rpm         1.1 MB/s | 539 kB     00:00
    (25/31): rpm-build-libs-4.14.2-26.el8_1.x86_64. 360 kB/s | 153 kB     00:00
    (26/31): rpm-libs-4.14.2-26.el8_1.x86_64.rpm    674 kB/s | 336 kB     00:00
    (27/31): sqlite-libs-3.26.0-4.el8_1.x86_64.rpm  755 kB/s | 579 kB     00:00
    (28/31): systemd-libs-239-18.el8_1.5.x86_64.rpm 471 kB/s | 562 kB     00:01
    (29/31): systemd-239-18.el8_1.5.x86_64.rpm      1.4 MB/s | 3.5 MB     00:02
    (30/31): systemd-pam-239-18.el8_1.5.x86_64.rpm  133 kB/s | 232 kB     00:01
    (31/31): systemd-udev-239-18.el8_1.5.x86_64.rpm 1.1 MB/s | 1.3 MB     00:01
    --------------------------------------------------------------------------------
    Total                                           1.4 MB/s |  26 MB     00:18
    warning: /var/cache/dnf/AppStream-02e86d1c976ab532/packages/libxkbcommon-0.8.2-1.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY
    CentOS-8 - AppStream                            1.6 MB/s | 1.6 kB     00:00
    Importing GPG key 0x8483C65D:
     Userid     : "CentOS (CentOS Official Signing Key) <security@centos.org>"
     Fingerprint: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D
     From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
    Key imported successfully
    Running transaction check
    Transaction check succeeded.
    Running transaction test
    Transaction test succeeded.
    Running transaction
      Preparing        :                                                        1/1
      Running scriptlet: centos-gpg-keys-8.1-1.1911.0.9.el8.noarch              1/1
      Upgrading        : centos-gpg-keys-8.1-1.1911.0.9.el8.noarch             1/53
      Upgrading        : centos-release-8.1-1.1911.0.9.el8.x86_64              2/53
      Upgrading        : centos-repos-8.1-1.1911.0.9.el8.x86_64                3/53
      Upgrading        : glibc-common-2.28-72.el8_1.1.x86_64                   4/53
      Running scriptlet: glibc-2.28-72.el8_1.1.x86_64                          5/53
      Upgrading        : glibc-2.28-72.el8_1.1.x86_64                          5/53
      Running scriptlet: glibc-2.28-72.el8_1.1.x86_64                          5/53
      Installing       : glibc-langpack-en-2.28-72.el8_1.1.x86_64              6/53
      Upgrading        : coreutils-single-8.30-6.el8_1.1.x86_64                7/53
      Upgrading        : audit-libs-3.0-0.13.20190507gitf58ec40.el8.x86_64     8/53
      Installing       : openssl-1:1.1.1c-2.el8_1.1.x86_64                     9/53
      Installing       : openssl-pkcs11-0.4.8-2.el8.x86_64                    10/53
      Running scriptlet: openssl-pkcs11-0.4.8-2.el8.x86_64                    10/53
      Upgrading        : openssl-libs-1:1.1.1c-2.el8_1.1.x86_64               11/53
      Running scriptlet: openssl-libs-1:1.1.1c-2.el8_1.1.x86_64               11/53
      Upgrading        : libarchive-3.3.2-8.el8_1.x86_64                      12/53
      Upgrading        : rpm-4.14.2-26.el8_1.x86_64                           13/53
      Upgrading        : rpm-libs-4.14.2-26.el8_1.x86_64                      14/53
      Running scriptlet: rpm-libs-4.14.2-26.el8_1.x86_64                      14/53
      Upgrading        : rpm-build-libs-4.14.2-26.el8_1.x86_64                15/53
      Running scriptlet: rpm-build-libs-4.14.2-26.el8_1.x86_64                15/53
      Upgrading        : systemd-libs-239-18.el8_1.5.x86_64                   16/53
      Running scriptlet: systemd-libs-239-18.el8_1.5.x86_64                   16/53
      Installing       : diffutils-3.6-5.el8.x86_64                           17/53
      Running scriptlet: diffutils-3.6-5.el8.x86_64                           17/53
      Installing       : kbd-misc-2.0.4-8.el8.noarch                          18/53
      Installing       : kbd-legacy-2.0.4-8.el8.noarch                        19/53
      Installing       : kbd-2.0.4-8.el8.x86_64                               20/53
      Installing       : xkeyboard-config-2.24-3.el8.noarch                   21/53
      Installing       : libxkbcommon-0.8.2-1.el8.x86_64                      22/53
      Upgrading        : systemd-pam-239-18.el8_1.5.x86_64                    23/53
      Running scriptlet: systemd-239-18.el8_1.5.x86_64                        24/53
      Upgrading        : systemd-239-18.el8_1.5.x86_64                        24/53
      Running scriptlet: systemd-239-18.el8_1.5.x86_64                        24/53
      Upgrading        : kexec-tools-2.0.19-12.el8_1.2.x86_64                 25/53
      Running scriptlet: kexec-tools-2.0.19-12.el8_1.2.x86_64                 25/53
      Upgrading        : systemd-udev-239-18.el8_1.5.x86_64                   26/53
      Running scriptlet: systemd-udev-239-18.el8_1.5.x86_64                   26/53
      Upgrading        : python3-rpm-4.14.2-26.el8_1.x86_64                   27/53
      Upgrading        : openldap-2.4.46-11.el8_1.x86_64                      28/53
      Upgrading        : binutils-2.30-58.el8_1.2.x86_64                      29/53
      Running scriptlet: binutils-2.30-58.el8_1.2.x86_64                      29/53
      Upgrading        : glibc-minimal-langpack-2.28-72.el8_1.1.x86_64        30/53
      Upgrading        : sqlite-libs-3.26.0-4.el8_1.x86_64                    31/53
      Cleanup          : systemd-udev-239-18.el8_1.1.x86_64                   32/53
      Running scriptlet: systemd-udev-239-18.el8_1.1.x86_64                   32/53
      Running scriptlet: kexec-tools-2.0.19-12.el8_1.1.x86_64                 33/53
      Cleanup          : kexec-tools-2.0.19-12.el8_1.1.x86_64                 33/53
      Running scriptlet: kexec-tools-2.0.19-12.el8_1.1.x86_64                 33/53
      Running scriptlet: systemd-239-18.el8_1.1.x86_64                        34/53
      Cleanup          : systemd-239-18.el8_1.1.x86_64                        34/53
      Cleanup          : systemd-libs-239-18.el8_1.1.x86_64                   35/53
      Cleanup          : systemd-pam-239-18.el8_1.1.x86_64                    36/53
      Cleanup          : openldap-2.4.46-10.el8.x86_64                        37/53
      Cleanup          : python3-rpm-4.14.2-25.el8.x86_64                     38/53
      Cleanup          : rpm-build-libs-4.14.2-25.el8.x86_64                  39/53
      Running scriptlet: rpm-build-libs-4.14.2-25.el8.x86_64                  39/53
      Cleanup          : rpm-4.14.2-25.el8.x86_64                             40/53
      Cleanup          : rpm-libs-4.14.2-25.el8.x86_64                        41/53
      Running scriptlet: rpm-libs-4.14.2-25.el8.x86_64                        41/53
      Running scriptlet: binutils-2.30-58.el8.0.1.x86_64                      42/53
      Cleanup          : binutils-2.30-58.el8.0.1.x86_64                      42/53
      Running scriptlet: binutils-2.30-58.el8.0.1.x86_64                      42/53
      Cleanup          : centos-release-8.1-1.1911.0.8.el8.x86_64             43/53
      Cleanup          : coreutils-single-8.30-6.el8.x86_64                   44/53
      Cleanup          : libarchive-3.3.2-7.el8.x86_64                        45/53
      Cleanup          : openssl-libs-1:1.1.1c-2.el8.x86_64                   46/53
      Running scriptlet: openssl-libs-1:1.1.1c-2.el8.x86_64                   46/53
      Cleanup          : sqlite-libs-3.26.0-3.el8.x86_64                      47/53
      Cleanup          : audit-libs-3.0-0.10.20180831git0047a6c.el8.x86_64    48/53
      Cleanup          : centos-repos-8.1-1.1911.0.8.el8.x86_64               49/53
      Cleanup          : glibc-2.28-72.el8.x86_64                             50/53
      Cleanup          : glibc-minimal-langpack-2.28-72.el8.x86_64            51/53
      Cleanup          : centos-gpg-keys-8.1-1.1911.0.8.el8.noarch            52/53
      Cleanup          : glibc-common-2.28-72.el8.x86_64                      53/53
      Running scriptlet: glibc-common-2.28-72.el8.x86_64                      53/53
      Running scriptlet: glibc-common-2.28-72.el8_1.1.x86_64                  53/53
      Running scriptlet: systemd-239-18.el8_1.5.x86_64                        53/53
      Running scriptlet: systemd-udev-239-18.el8_1.5.x86_64                   53/53
      Verifying        : libxkbcommon-0.8.2-1.el8.x86_64                       1/53
      Verifying        : xkeyboard-config-2.24-3.el8.noarch                    2/53
      Verifying        : diffutils-3.6-5.el8.x86_64                            3/53
      Verifying        : glibc-langpack-en-2.28-72.el8_1.1.x86_64              4/53
      Verifying        : kbd-2.0.4-8.el8.x86_64                                5/53
      Verifying        : kbd-legacy-2.0.4-8.el8.noarch                         6/53
      Verifying        : kbd-misc-2.0.4-8.el8.noarch                           7/53
      Verifying        : openssl-1:1.1.1c-2.el8_1.1.x86_64                     8/53
      Verifying        : openssl-pkcs11-0.4.8-2.el8.x86_64                     9/53
      Verifying        : audit-libs-3.0-0.13.20190507gitf58ec40.el8.x86_64    10/53
      Verifying        : audit-libs-3.0-0.10.20180831git0047a6c.el8.x86_64    11/53
      Verifying        : binutils-2.30-58.el8_1.2.x86_64                      12/53
      Verifying        : binutils-2.30-58.el8.0.1.x86_64                      13/53
      Verifying        : centos-gpg-keys-8.1-1.1911.0.9.el8.noarch            14/53
      Verifying        : centos-gpg-keys-8.1-1.1911.0.8.el8.noarch            15/53
      Verifying        : centos-release-8.1-1.1911.0.9.el8.x86_64             16/53
      Verifying        : centos-release-8.1-1.1911.0.8.el8.x86_64             17/53
      Verifying        : centos-repos-8.1-1.1911.0.9.el8.x86_64               18/53
      Verifying        : centos-repos-8.1-1.1911.0.8.el8.x86_64               19/53
      Verifying        : coreutils-single-8.30-6.el8_1.1.x86_64               20/53
      Verifying        : coreutils-single-8.30-6.el8.x86_64                   21/53
      Verifying        : glibc-2.28-72.el8_1.1.x86_64                         22/53
      Verifying        : glibc-2.28-72.el8.x86_64                             23/53
      Verifying        : glibc-common-2.28-72.el8_1.1.x86_64                  24/53
      Verifying        : glibc-common-2.28-72.el8.x86_64                      25/53
      Verifying        : glibc-minimal-langpack-2.28-72.el8_1.1.x86_64        26/53
      Verifying        : glibc-minimal-langpack-2.28-72.el8.x86_64            27/53
      Verifying        : kexec-tools-2.0.19-12.el8_1.2.x86_64                 28/53
      Verifying        : kexec-tools-2.0.19-12.el8_1.1.x86_64                 29/53
      Verifying        : libarchive-3.3.2-8.el8_1.x86_64                      30/53
      Verifying        : libarchive-3.3.2-7.el8.x86_64                        31/53
      Verifying        : openldap-2.4.46-11.el8_1.x86_64                      32/53
      Verifying        : openldap-2.4.46-10.el8.x86_64                        33/53
      Verifying        : openssl-libs-1:1.1.1c-2.el8_1.1.x86_64               34/53
      Verifying        : openssl-libs-1:1.1.1c-2.el8.x86_64                   35/53
      Verifying        : python3-rpm-4.14.2-26.el8_1.x86_64                   36/53
      Verifying        : python3-rpm-4.14.2-25.el8.x86_64                     37/53
      Verifying        : rpm-4.14.2-26.el8_1.x86_64                           38/53
      Verifying        : rpm-4.14.2-25.el8.x86_64                             39/53
      Verifying        : rpm-build-libs-4.14.2-26.el8_1.x86_64                40/53
      Verifying        : rpm-build-libs-4.14.2-25.el8.x86_64                  41/53
      Verifying        : rpm-libs-4.14.2-26.el8_1.x86_64                      42/53
      Verifying        : rpm-libs-4.14.2-25.el8.x86_64                        43/53
      Verifying        : sqlite-libs-3.26.0-4.el8_1.x86_64                    44/53
      Verifying        : sqlite-libs-3.26.0-3.el8.x86_64                      45/53
      Verifying        : systemd-239-18.el8_1.5.x86_64                        46/53
      Verifying        : systemd-239-18.el8_1.1.x86_64                        47/53
      Verifying        : systemd-libs-239-18.el8_1.5.x86_64                   48/53
      Verifying        : systemd-libs-239-18.el8_1.1.x86_64                   49/53
      Verifying        : systemd-pam-239-18.el8_1.5.x86_64                    50/53
      Verifying        : systemd-pam-239-18.el8_1.1.x86_64                    51/53
      Verifying        : systemd-udev-239-18.el8_1.5.x86_64                   52/53
      Verifying        : systemd-udev-239-18.el8_1.1.x86_64                   53/53
    
    Upgraded:
      audit-libs-3.0-0.13.20190507gitf58ec40.el8.x86_64
      binutils-2.30-58.el8_1.2.x86_64
      centos-gpg-keys-8.1-1.1911.0.9.el8.noarch
      centos-release-8.1-1.1911.0.9.el8.x86_64
      centos-repos-8.1-1.1911.0.9.el8.x86_64
      coreutils-single-8.30-6.el8_1.1.x86_64
      glibc-2.28-72.el8_1.1.x86_64
      glibc-common-2.28-72.el8_1.1.x86_64
      glibc-minimal-langpack-2.28-72.el8_1.1.x86_64
      kexec-tools-2.0.19-12.el8_1.2.x86_64
      libarchive-3.3.2-8.el8_1.x86_64
      openldap-2.4.46-11.el8_1.x86_64
      openssl-libs-1:1.1.1c-2.el8_1.1.x86_64
      python3-rpm-4.14.2-26.el8_1.x86_64
      rpm-4.14.2-26.el8_1.x86_64
      rpm-build-libs-4.14.2-26.el8_1.x86_64
      rpm-libs-4.14.2-26.el8_1.x86_64
      sqlite-libs-3.26.0-4.el8_1.x86_64
      systemd-239-18.el8_1.5.x86_64
      systemd-libs-239-18.el8_1.5.x86_64
      systemd-pam-239-18.el8_1.5.x86_64
      systemd-udev-239-18.el8_1.5.x86_64
    
    Installed:
      libxkbcommon-0.8.2-1.el8.x86_64           diffutils-3.6-5.el8.x86_64
      glibc-langpack-en-2.28-72.el8_1.1.x86_64  kbd-2.0.4-8.el8.x86_64
      openssl-pkcs11-0.4.8-2.el8.x86_64         xkeyboard-config-2.24-3.el8.noarch
      kbd-legacy-2.0.4-8.el8.noarch             kbd-misc-2.0.4-8.el8.noarch
      openssl-1:1.1.1c-2.el8_1.1.x86_64
    
    Complete!
    Last metadata expiration check: 0:00:40 ago on Sun Apr 19 07:14:51 2020.
    Dependencies resolved.
    ================================================================================
     Package          Arch   Version                                Repo       Size
    ================================================================================
    Installing:
     subversion       x86_64 1.10.2-1.module_el8.0.0+45+75bba4f4    AppStream 1.1 M
    Installing dependencies:
     apr              x86_64 1.6.3-9.el8                            AppStream 125 k
     apr-util         x86_64 1.6.1-6.el8                            AppStream 105 k
     libserf          x86_64 1.3.9-8.module_el8.0.0+45+75bba4f4     AppStream  60 k
     subversion-libs  x86_64 1.10.2-1.module_el8.0.0+45+75bba4f4    AppStream 1.5 M
     utf8proc         x86_64 2.1.1-4.module_el8.0.0+45+75bba4f4     AppStream  67 k
    Installing weak dependencies:
     apr-util-bdb     x86_64 1.6.1-6.el8                            AppStream  25 k
     apr-util-openssl x86_64 1.6.1-6.el8                            AppStream  27 k
    Enabling module streams:
     subversion              1.10
    
    Transaction Summary
    ================================================================================
    Install  8 Packages
    
    Total download size: 3.0 M
    Installed size: 11 M
    Downloading Packages:
    (1/8): apr-util-bdb-1.6.1-6.el8.x86_64.rpm      159 kB/s |  25 kB     00:00
    (2/8): apr-1.6.3-9.el8.x86_64.rpm               580 kB/s | 125 kB     00:00
    (3/8): apr-util-openssl-1.6.1-6.el8.x86_64.rpm  378 kB/s |  27 kB     00:00
    (4/8): apr-util-1.6.1-6.el8.x86_64.rpm          451 kB/s | 105 kB     00:00
    (5/8): libserf-1.3.9-8.module_el8.0.0+45+75bba4 661 kB/s |  60 kB     00:00
    (6/8): utf8proc-2.1.1-4.module_el8.0.0+45+75bba 470 kB/s |  67 kB     00:00
    (7/8): subversion-libs-1.10.2-1.module_el8.0.0+ 4.4 MB/s | 1.5 MB     00:00
    (8/8): subversion-1.10.2-1.module_el8.0.0+45+75 1.2 MB/s | 1.1 MB     00:00
    --------------------------------------------------------------------------------
    Total                                           1.8 MB/s | 3.0 MB     00:01
    Running transaction check
    Transaction check succeeded.
    Running transaction test
    Transaction test succeeded.
    Running transaction
      Preparing        :                                                        1/1
      Installing       : apr-1.6.3-9.el8.x86_64                                 1/8
      Running scriptlet: apr-1.6.3-9.el8.x86_64                                 1/8
      Installing       : apr-util-bdb-1.6.1-6.el8.x86_64                        2/8
      Installing       : apr-util-openssl-1.6.1-6.el8.x86_64                    3/8
      Installing       : apr-util-1.6.1-6.el8.x86_64                            4/8
      Running scriptlet: apr-util-1.6.1-6.el8.x86_64                            4/8
      Installing       : libserf-1.3.9-8.module_el8.0.0+45+75bba4f4.x86_64      5/8
      Running scriptlet: libserf-1.3.9-8.module_el8.0.0+45+75bba4f4.x86_64      5/8
      Installing       : utf8proc-2.1.1-4.module_el8.0.0+45+75bba4f4.x86_64     6/8
      Running scriptlet: utf8proc-2.1.1-4.module_el8.0.0+45+75bba4f4.x86_64     6/8
      Installing       : subversion-libs-1.10.2-1.module_el8.0.0+45+75bba4f4.   7/8
      Running scriptlet: subversion-libs-1.10.2-1.module_el8.0.0+45+75bba4f4.   7/8
      Installing       : subversion-1.10.2-1.module_el8.0.0+45+75bba4f4.x86_6   8/8
      Running scriptlet: subversion-1.10.2-1.module_el8.0.0+45+75bba4f4.x86_6   8/8
      Verifying        : apr-1.6.3-9.el8.x86_64                                 1/8
      Verifying        : apr-util-1.6.1-6.el8.x86_64                            2/8
      Verifying        : apr-util-bdb-1.6.1-6.el8.x86_64                        3/8
      Verifying        : apr-util-openssl-1.6.1-6.el8.x86_64                    4/8
      Verifying        : libserf-1.3.9-8.module_el8.0.0+45+75bba4f4.x86_64      5/8
      Verifying        : subversion-1.10.2-1.module_el8.0.0+45+75bba4f4.x86_6   6/8
      Verifying        : subversion-libs-1.10.2-1.module_el8.0.0+45+75bba4f4.   7/8
      Verifying        : utf8proc-2.1.1-4.module_el8.0.0+45+75bba4f4.x86_64     8/8
    
    Installed:
      subversion-1.10.2-1.module_el8.0.0+45+75bba4f4.x86_64
      apr-util-bdb-1.6.1-6.el8.x86_64
      apr-util-openssl-1.6.1-6.el8.x86_64
      apr-1.6.3-9.el8.x86_64
      apr-util-1.6.1-6.el8.x86_64
      libserf-1.3.9-8.module_el8.0.0+45+75bba4f4.x86_64
      subversion-libs-1.10.2-1.module_el8.0.0+45+75bba4f4.x86_64
      utf8proc-2.1.1-4.module_el8.0.0+45+75bba4f4.x86_64
    
    Complete!
    Removing intermediate container 50105d860dc9
     ---> f2168e97f342
    Step 3/6 : RUN yum install -y openssh-server && sed -i -e 's/#LoginGraceTime 2m/LoginGraceTime 2m/g' -e 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' -e 's/#StrictModes yes/StrictModes yes/g' /etc/ssh/sshd_config && mkdir /var/run/sshd && echo 'UseDNS no' >> /etc/ssh/sshd_config && sed -i -e '/pam_loginuid.so/d' /etc/pam.d/sshd && echo 'root:1qaz@WSX' | chpasswd && /usr/bin/ssh-keygen -A
     ---> Running in 6564c2a3ba47
    Last metadata expiration check: 0:00:55 ago on Sun Apr 19 07:14:51 2020.
    Dependencies resolved.
    ================================================================================
     Package               Architecture  Version                Repository     Size
    ================================================================================
    Installing:
     openssh-server        x86_64        8.0p1-4.el8_1          BaseOS        485 k
    Installing dependencies:
     fipscheck             x86_64        1.5.0-4.el8            BaseOS         28 k
     fipscheck-lib         x86_64        1.5.0-4.el8            BaseOS         16 k
     openssh               x86_64        8.0p1-4.el8_1          BaseOS        496 k
    
    Transaction Summary
    ================================================================================
    Install  4 Packages
    
    Total download size: 1.0 M
    Installed size: 3.6 M
    Downloading Packages:
    (1/4): fipscheck-lib-1.5.0-4.el8.x86_64.rpm      66 kB/s |  16 kB     00:00
    (2/4): fipscheck-1.5.0-4.el8.x86_64.rpm         108 kB/s |  28 kB     00:00
    (3/4): openssh-8.0p1-4.el8_1.x86_64.rpm         901 kB/s | 496 kB     00:00
    (4/4): openssh-server-8.0p1-4.el8_1.x86_64.rpm  835 kB/s | 485 kB     00:00
    --------------------------------------------------------------------------------
    Total                                           793 kB/s | 1.0 MB     00:01
    Running transaction check
    Transaction check succeeded.
    Running transaction test
    Transaction test succeeded.
    Running transaction
      Preparing        :                                                        1/1
      Installing       : fipscheck-lib-1.5.0-4.el8.x86_64                       1/4
      Running scriptlet: fipscheck-lib-1.5.0-4.el8.x86_64                       1/4
      Installing       : fipscheck-1.5.0-4.el8.x86_64                           2/4
      Running scriptlet: openssh-8.0p1-4.el8_1.x86_64                           3/4
      Installing       : openssh-8.0p1-4.el8_1.x86_64                           3/4
      Running scriptlet: openssh-server-8.0p1-4.el8_1.x86_64                    4/4
      Installing       : openssh-server-8.0p1-4.el8_1.x86_64                    4/4
      Running scriptlet: openssh-server-8.0p1-4.el8_1.x86_64                    4/4
      Verifying        : fipscheck-1.5.0-4.el8.x86_64                           1/4
      Verifying        : fipscheck-lib-1.5.0-4.el8.x86_64                       2/4
      Verifying        : openssh-8.0p1-4.el8_1.x86_64                           3/4
      Verifying        : openssh-server-8.0p1-4.el8_1.x86_64                    4/4
    
    Installed:
      openssh-server-8.0p1-4.el8_1.x86_64        fipscheck-1.5.0-4.el8.x86_64
      fipscheck-lib-1.5.0-4.el8.x86_64           openssh-8.0p1-4.el8_1.x86_64
    
    Complete!
    ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
    Removing intermediate container 6564c2a3ba47
     ---> c8c82f4c6ce5
    Step 4/6 : COPY init.sh /usr/svn/
     ---> 5ff7d71f6a5a
    Step 5/6 : EXPOSE 3690
     ---> Running in 19907bfb9086
    Removing intermediate container 19907bfb9086
     ---> 146f76ba27dd
    Step 6/6 : CMD ["/bin/bash","/usr/svn/init.sh"]
     ---> Running in 6d0ea8f403c1
    Removing intermediate container 6d0ea8f403c1
     ---> a90e7e80820d
    Successfully built a90e7e80820d
    Successfully tagged kevin/svnsrv:1.13.0
    
    [root@Server dockerfile]# docker image ls -a
    REPOSITORY          TAG                 IMAGE ID            CREATED              SIZE
    <none>              <none>              146f76ba27dd        About a minute ago   437MB
    kevin/svnsrv        1.13.0              a90e7e80820d        About a minute ago   437MB
    <none>              <none>              c8c82f4c6ce5        About a minute ago   437MB
    <none>              <none>              5ff7d71f6a5a        About a minute ago   437MB
    <none>              <none>              f2168e97f342        2 minutes ago        402MB
    centos              8.1.1911            470671670cac        3 months ago         237MB
    

    3、运行验证镜像

    [root@Server dockerfile]# docker container run -d --name "svnsrv01" -p 3690 kevin/svnsrv:1.13.0
    
    [root@Server dockerfile]# docker container ls -a
    CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS              PORTS                     NAMES
    0c5d58816256        kevin/svnsrv:1.13.0   "/bin/bash /usr/svn/…"   13 seconds ago      Up 10 seconds       0.0.0.0:32778->3690/tcp   svnsrv01
    
    [root@Server dockerfile]# svn co svn://192.168.28.8:32778/repository --username admin --password 1qaz@WSX
    
    -----------------------------------------------------------------------
    ATTENTION!  Your password for authentication realm:
    
       <svn://192.168.28.8:32778> repository
    
    can only be stored to disk unencrypted!  You are advised to configure
    your system so that Subversion can store passwords encrypted, if
    possible.  See the documentation for details.
    
    You can avoid future appearances of this warning by setting the value
    of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
    '/root/.subversion/servers'.
    -----------------------------------------------------------------------
    Store password unencrypted (yes/no)? yes
    Checked out revision 0.
    

    相关文章

      网友评论

        本文标题:Docker管理-基于CentOS通过Dockerfile制作S

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