CentOS7 Docker 설치 작업 및 기본 명령

67211 단어 Docker
CentOS7 Docker 설치 작업 및 기본 명령 제목
1. docker 설치
yum -y install docker-io
[root@localhost ~]# yum -y install docker-io 
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.btte.net
 * updates: mirrors.163.com
Resolving Dependencies
--> Running transaction check
---> Package docker.x86_64 2:1.12.6-28.git1398f24.el7.centos will be installed
--> Processing Dependency: docker-common = 2:1.12.6-28.git1398f24.el7.centos for package: 2:docker-1.12.6-28.git1398f24.el7.centos.x86_64
--> Processing Dependency: docker-client = 2:1.12.6-28.git1398f24.el7.centos for package: 2:docker-1.12.6-28.git1398f24.el7.centos.x86_64
--> Processing Dependency: oci-systemd-hook >= 1:0.1.4-9 for package: 2:docker-1.12.6-28.git1398f24.el7.centos.x86_64
--> Processing Dependency: oci-register-machine >= 1:0-3.10 for package: 2:docker-1.12.6-28.git1398f24.el7.centos.x86_64
--> Processing Dependency: container-selinux >= 2:2.12-2 for package: 2:docker-1.12.6-28.git1398f24.el7.centos.x86_64
--> Processing Dependency: skopeo-containers for package: 2:docker-1.12.6-28.git1398f24.el7.centos.x86_64
--> Running transaction check
---> Package container-selinux.noarch 2:2.12-2.gite7096ce.el7 will be installed
--> Processing Dependency: policycoreutils >= 2.5-11 for package: 2:container-selinux-2.12-2.gite7096ce.el7.noarch
---> Package docker-client.x86_64 2:1.12.6-28.git1398f24.el7.centos will be installed
---> Package docker-common.x86_64 2:1.12.6-28.git1398f24.el7.centos will be installed
---> Package oci-register-machine.x86_64 1:0-3.11.gitdd0daef.el7 will be installed
---> Package oci-systemd-hook.x86_64 1:0.1.7-2.git2788078.el7 will be installed
---> Package skopeo-containers.x86_64 1:0.1.19-1.el7 will be installed
--> Running transaction check
---> Package policycoreutils.x86_64 0:2.2.5-20.el7 will be updated
--> Processing Dependency: policycoreutils = 2.2.5-20.el7 for package: policycoreutils-python-2.2.5-20.el7.x86_64
---> Package policycoreutils.x86_64 0:2.5-11.el7_3 will be an update
--> Processing Dependency: libsepol >= 2.5-6 for package: policycoreutils-2.5-11.el7_3.x86_64
--> Processing Dependency: libselinux-utils >= 2.5-6 for package: policycoreutils-2.5-11.el7_3.x86_64
--> Processing Dependency: libsepol.so.1(LIBSEPOL_1.1)(64bit) for package: policycoreutils-2.5-11.el7_3.x86_64
--> Processing Dependency: libsepol.so.1(LIBSEPOL_1.0)(64bit) for package: policycoreutils-2.5-11.el7_3.x86_64
--> Processing Dependency: libsemanage.so.1(LIBSEMANAGE_1.1)(64bit) for package: policycoreutils-2.5-11.el7_3.x86_64
--> Running transaction check
---> Package libselinux-utils.x86_64 0:2.2.2-6.el7 will be updated
---> Package libselinux-utils.x86_64 0:2.5-6.el7 will be an update
--> Processing Dependency: libselinux(x86-64) = 2.5-6.el7 for package: libselinux-utils-2.5-6.el7.x86_64
---> Package libsemanage.x86_64 0:2.1.10-18.el7 will be updated
--> Processing Dependency: libsemanage = 2.1.10-18.el7 for package: libsemanage-python-2.1.10-18.el7.x86_64
---> Package libsemanage.x86_64 0:2.5-5.1.el7_3 will be an update
---> Package libsepol.x86_64 0:2.1.9-3.el7 will be updated
---> Package libsepol.x86_64 0:2.5-6.el7 will be an update
---> Package policycoreutils-python.x86_64 0:2.2.5-20.el7 will be updated
---> Package policycoreutils-python.x86_64 0:2.5-11.el7_3 will be an update
--> Processing Dependency: setools-libs >= 3.3.8-1 for package: policycoreutils-python-2.5-11.el7_3.x86_64
--> Running transaction check
---> Package libselinux.x86_64 0:2.2.2-6.el7 will be updated
--> Processing Dependency: libselinux = 2.2.2-6.el7 for package: libselinux-python-2.2.2-6.el7.x86_64
---> Package libselinux.x86_64 0:2.5-6.el7 will be an update
---> Package libsemanage-python.x86_64 0:2.1.10-18.el7 will be updated
---> Package libsemanage-python.x86_64 0:2.5-5.1.el7_3 will be an update
---> Package setools-libs.x86_64 0:3.3.7-46.el7 will be updated
---> Package setools-libs.x86_64 0:3.3.8-1.1.el7 will be an update
--> Running transaction check
---> Package libselinux-python.x86_64 0:2.2.2-6.el7 will be updated
---> Package libselinux-python.x86_64 0:2.5-6.el7 will be an update
--> Processing Conflict: libsemanage-2.5-5.1.el7_3.x86_64 conflicts selinux-policy-base < 3.13.1-66
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package selinux-policy-targeted.noarch 0:3.13.1-60.el7 will be updated
---> Package selinux-policy-targeted.noarch 0:3.13.1-102.el7_3.16 will be an update
--> Processing Dependency: selinux-policy = 3.13.1-102.el7_3.16 for package: selinux-policy-targeted-3.13.1-102.el7_3.16.noarch
--> Processing Dependency: selinux-policy = 3.13.1-102.el7_3.16 for package: selinux-policy-targeted-3.13.1-102.el7_3.16.noarch
--> Running transaction check
---> Package selinux-policy.noarch 0:3.13.1-60.el7 will be updated
---> Package selinux-policy.noarch 0:3.13.1-102.el7_3.16 will be an update
--> Processing Conflict: libselinux-2.5-6.el7.x86_64 conflicts systemd < 219-20
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package systemd.x86_64 0:219-19.el7 will be updated
--> Processing Dependency: systemd = 219-19.el7 for package: systemd-python-219-19.el7.x86_64
--> Processing Dependency: systemd = 219-19.el7 for package: systemd-sysv-219-19.el7.x86_64
---> Package systemd.x86_64 0:219-30.el7_3.9 will be an update
--> Processing Dependency: systemd-libs = 219-30.el7_3.9 for package: systemd-219-30.el7_3.9.x86_64
--> Running transaction check
---> Package systemd-libs.x86_64 0:219-19.el7 will be updated
--> Processing Dependency: systemd-libs = 219-19.el7 for package: libgudev1-219-19.el7.x86_64
---> Package systemd-libs.x86_64 0:219-30.el7_3.9 will be an update
---> Package systemd-python.x86_64 0:219-19.el7 will be updated
---> Package systemd-python.x86_64 0:219-30.el7_3.9 will be an update
---> Package systemd-sysv.x86_64 0:219-19.el7 will be updated
---> Package systemd-sysv.x86_64 0:219-30.el7_3.9 will be an update
--> Running transaction check
---> Package libgudev1.x86_64 0:219-19.el7 will be updated
---> Package libgudev1.x86_64 0:219-30.el7_3.9 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================================================
 Package                                                        Arch                                          Version                                                                  Repository                                      Size
============================================================================================================================================================================================================================================
Installing:
 docker                                                         x86_64                                        2:1.12.6-28.git1398f24.el7.centos                                        extras                                          14 M
Updating:
 selinux-policy-targeted                                        noarch                                        3.13.1-102.el7_3.16                                                      updates                                        6.4 M
 systemd                                                        x86_64                                        219-30.el7_3.9                                                           updates                                        5.2 M
Installing for dependencies:
 container-selinux                                              noarch                                        2:2.12-2.gite7096ce.el7                                                  extras                                          28 k
 docker-client                                                  x86_64                                        2:1.12.6-28.git1398f24.el7.centos                                        extras                                         3.2 M
 docker-common                                                  x86_64                                        2:1.12.6-28.git1398f24.el7.centos                                        extras                                          75 k
 oci-register-machine                                           x86_64                                        1:0-3.11.gitdd0daef.el7                                                  extras                                         1.0 M
 oci-systemd-hook                                               x86_64                                        1:0.1.7-2.git2788078.el7                                                 extras                                          30 k
 skopeo-containers                                              x86_64                                        1:0.1.19-1.el7                                                           extras                                         7.7 k
Updating for dependencies:
 libgudev1                                                      x86_64                                        219-30.el7_3.9                                                           updates                                         77 k
 libselinux                                                     x86_64                                        2.5-6.el7                                                                base                                           161 k
 libselinux-python                                              x86_64                                        2.5-6.el7                                                                base                                           234 k
 libselinux-utils                                               x86_64                                        2.5-6.el7                                                                base                                           151 k
 libsemanage                                                    x86_64                                        2.5-5.1.el7_3                                                            updates                                        144 k
 libsemanage-python                                             x86_64                                        2.5-5.1.el7_3                                                            updates                                        104 k
 libsepol                                                       x86_64                                        2.5-6.el7                                                                base                                           288 k
 policycoreutils                                                x86_64                                        2.5-11.el7_3                                                             updates                                        841 k
 policycoreutils-python                                         x86_64                                        2.5-11.el7_3                                                             updates                                        445 k
 selinux-policy                                                 noarch                                        3.13.1-102.el7_3.16                                                      updates                                        414 k
 setools-libs                                                   x86_64                                        3.3.8-1.1.el7                                                            base                                           612 k
 systemd-libs                                                   x86_64                                        219-30.el7_3.9                                                           updates                                        369 k
 systemd-python                                                 x86_64                                        219-30.el7_3.9                                                           updates                                        110 k
 systemd-sysv                                                   x86_64                                        219-30.el7_3.9                                                           updates                                         64 k

Transaction Summary
============================================================================================================================================================================================================================================
Install  1 Package  (+ 6 Dependent packages)
Upgrade  2 Packages (+14 Dependent packages)

Total size: 34 M
Total download size: 19 M
Downloading packages:
(1/7): container-selinux-2.12-2.gite7096ce.el7.noarch.rpm                                                                                                                                                            |  28 kB  00:00:00     
(2/7): docker-common-1.12.6-28.git1398f24.el7.centos.x86_64.rpm                                                                                                                                                      |  75 kB  00:00:00     
(3/7): skopeo-containers-0.1.19-1.el7.x86_64.rpm                                                                                                                                                                     | 7.7 kB  00:00:00     
(4/7): oci-systemd-hook-0.1.7-2.git2788078.el7.x86_64.rpm                                                                                                                                                            |  30 kB  00:00:00     
(5/7): oci-register-machine-0-3.11.gitdd0daef.el7.x86_64.rpm                                                                                                                                                         | 1.0 MB  00:00:01     
(6/7): docker-1.12.6-28.git1398f24.el7.centos.x86_64.rpm                                                                                                                                                             |  14 MB  00:00:01     
(7/7): docker-client-1.12.6-28.git1398f24.el7.centos.x86_64.rpm                                                                                                                                                      | 3.2 MB  00:00:02     
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                       7.8 MB/s |  19 MB  00:00:02     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : libsepol-2.5-6.el7.x86_64                                                                                                                                                                                               1/39 
  Updating   : libselinux-2.5-6.el7.x86_64                                                                                                                                                                                             2/39 
  Updating   : systemd-libs-219-30.el7_3.9.x86_64                                                                                                                                                                                      3/39 
  Updating   : systemd-219-30.el7_3.9.x86_64                                                                                                                                                                                           4/39 
  Updating   : libsemanage-2.5-5.1.el7_3.x86_64                                                                                                                                                                                        5/39 
  Updating   : libselinux-utils-2.5-6.el7.x86_64                                                                                                                                                                                       6/39 
  Updating   : policycoreutils-2.5-11.el7_3.x86_64                                                                                                                                                                                     7/39 
  Updating   : selinux-policy-3.13.1-102.el7_3.16.noarch                                                                                                                                                                               8/39 
  Installing : 2:docker-common-1.12.6-28.git1398f24.el7.centos.x86_64                                                                                                                                                                  9/39 
  Installing : 2:docker-client-1.12.6-28.git1398f24.el7.centos.x86_64                                                                                                                                                                 10/39 
  Updating   : selinux-policy-targeted-3.13.1-102.el7_3.16.noarch                                                                                                                                                                     11/39 
  Updating   : libsemanage-python-2.5-5.1.el7_3.x86_64                                                                                                                                                                                12/39 
  Installing : 1:oci-register-machine-0-3.11.gitdd0daef.el7.x86_64                                                                                                                                                                    13/39 
  Updating   : libselinux-python-2.5-6.el7.x86_64                                                                                                                                                                                     14/39 
  Installing : 1:oci-systemd-hook-0.1.7-2.git2788078.el7.x86_64                                                                                                                                                                       15/39 
  Updating   : setools-libs-3.3.8-1.1.el7.x86_64                                                                                                                                                                                      16/39 
  Updating   : policycoreutils-python-2.5-11.el7_3.x86_64                                                                                                                                                                             17/39 
  Installing : 2:container-selinux-2.12-2.gite7096ce.el7.noarch                                                                                                                                                                       18/39 
  Installing : 1:skopeo-containers-0.1.19-1.el7.x86_64                                                                                                                                                                                19/39 
Stopping containers...
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
"docker stop" requires at least 1 argument(s).
See 'docker stop --help'.

Usage:  docker stop [OPTIONS] CONTAINER [CONTAINER...]

Stop one or more running containers
  Installing : 2:docker-1.12.6-28.git1398f24.el7.centos.x86_64                                                                                                                                                                        20/39 
  Updating   : systemd-python-219-30.el7_3.9.x86_64                                                                                                                                                                                   21/39 
  Updating   : systemd-sysv-219-30.el7_3.9.x86_64                                                                                                                                                                                     22/39 
  Updating   : libgudev1-219-30.el7_3.9.x86_64                                                                                                                                                                                        23/39 
  Cleanup    : policycoreutils-python-2.2.5-20.el7.x86_64                                                                                                                                                                             24/39 
  Cleanup    : selinux-policy-targeted-3.13.1-60.el7.noarch                                                                                                                                                                           25/39 
  Cleanup    : systemd-python-219-19.el7.x86_64                                                                                                                                                                                       26/39 
  Cleanup    : selinux-policy-3.13.1-60.el7.noarch                                                                                                                                                                                    27/39 
  Cleanup    : systemd-sysv-219-19.el7.x86_64                                                                                                                                                                                         28/39 
  Cleanup    : policycoreutils-2.2.5-20.el7.x86_64                                                                                                                                                                                    29/39 
  Cleanup    : systemd-219-19.el7.x86_64                                                                                                                                                                                              30/39 
  Cleanup    : setools-libs-3.3.7-46.el7.x86_64                                                                                                                                                                                       31/39 
  Cleanup    : libselinux-utils-2.2.2-6.el7.x86_64                                                                                                                                                                                    32/39 
  Cleanup    : libselinux-python-2.2.2-6.el7.x86_64                                                                                                                                                                                   33/39 
  Cleanup    : libsemanage-python-2.1.10-18.el7.x86_64                                                                                                                                                                                34/39 
  Cleanup    : libsemanage-2.1.10-18.el7.x86_64                                                                                                                                                                                       35/39 
  Cleanup    : libgudev1-219-19.el7.x86_64                                                                                                                                                                                            36/39 
  Cleanup    : systemd-libs-219-19.el7.x86_64                                                                                                                                                                                         37/39 
  Cleanup    : libselinux-2.2.2-6.el7.x86_64                                                                                                                                                                                          38/39 
  Cleanup    : libsepol-2.1.9-3.el7.x86_64                                                                                                                                                                                            39/39 
  Verifying  : libsepol-2.5-6.el7.x86_64                                                                                                                                                                                               1/39 
  Verifying  : libselinux-python-2.5-6.el7.x86_64                                                                                                                                                                                      2/39 
  Verifying  : 1:oci-register-machine-0-3.11.gitdd0daef.el7.x86_64                                                                                                                                                                     3/39 
  Verifying  : policycoreutils-python-2.5-11.el7_3.x86_64                                                                                                                                                                              4/39 
  Verifying  : libselinux-utils-2.5-6.el7.x86_64                                                                                                                                                                                       5/39 
  Verifying  : policycoreutils-2.5-11.el7_3.x86_64                                                                                                                                                                                     6/39 
  Verifying  : 2:docker-1.12.6-28.git1398f24.el7.centos.x86_64                                                                                                                                                                         7/39 
  Verifying  : libgudev1-219-30.el7_3.9.x86_64                                                                                                                                                                                         8/39 
  Verifying  : systemd-219-30.el7_3.9.x86_64                                                                                                                                                                                           9/39 
  Verifying  : 2:docker-common-1.12.6-28.git1398f24.el7.centos.x86_64                                                                                                                                                                 10/39 
  Verifying  : selinux-policy-3.13.1-102.el7_3.16.noarch                                                                                                                                                                              11/39 
  Verifying  : selinux-policy-targeted-3.13.1-102.el7_3.16.noarch                                                                                                                                                                     12/39 
  Verifying  : libsemanage-2.5-5.1.el7_3.x86_64                                                                                                                                                                                       13/39 
  Verifying  : systemd-python-219-30.el7_3.9.x86_64                                                                                                                                                                                   14/39 
  Verifying  : 2:container-selinux-2.12-2.gite7096ce.el7.noarch                                                                                                                                                                       15/39 
  Verifying  : 1:skopeo-containers-0.1.19-1.el7.x86_64                                                                                                                                                                                16/39 
  Verifying  : libselinux-2.5-6.el7.x86_64                                                                                                                                                                                            17/39 
  Verifying  : systemd-sysv-219-30.el7_3.9.x86_64                                                                                                                                                                                     18/39 
  Verifying  : 1:oci-systemd-hook-0.1.7-2.git2788078.el7.x86_64                                                                                                                                                                       19/39 
  Verifying  : libsemanage-python-2.5-5.1.el7_3.x86_64                                                                                                                                                                                20/39 
  Verifying  : 2:docker-client-1.12.6-28.git1398f24.el7.centos.x86_64                                                                                                                                                                 21/39 
  Verifying  : systemd-libs-219-30.el7_3.9.x86_64                                                                                                                                                                                     22/39 
  Verifying  : setools-libs-3.3.8-1.1.el7.x86_64                                                                                                                                                                                      23/39 
  Verifying  : systemd-python-219-19.el7.x86_64                                                                                                                                                                                       24/39 
  Verifying  : libsemanage-python-2.1.10-18.el7.x86_64                                                                                                                                                                                25/39 
  Verifying  : setools-libs-3.3.7-46.el7.x86_64                                                                                                                                                                                       26/39 
  Verifying  : libsemanage-2.1.10-18.el7.x86_64                                                                                                                                                                                       27/39 
  Verifying  : systemd-sysv-219-19.el7.x86_64                                                                                                                                                                                         28/39 
  Verifying  : libgudev1-219-19.el7.x86_64                                                                                                                                                                                            29/39 
  Verifying  : systemd-219-19.el7.x86_64                                                                                                                                                                                              30/39 
  Verifying  : selinux-policy-3.13.1-60.el7.noarch                                                                                                                                                                                    31/39 
  Verifying  : systemd-libs-219-19.el7.x86_64                                                                                                                                                                                         32/39 
  Verifying  : libselinux-utils-2.2.2-6.el7.x86_64                                                                                                                                                                                    33/39 
  Verifying  : selinux-policy-targeted-3.13.1-60.el7.noarch                                                                                                                                                                           34/39 
  Verifying  : libsepol-2.1.9-3.el7.x86_64                                                                                                                                                                                            35/39 
  Verifying  : libselinux-python-2.2.2-6.el7.x86_64                                                                                                                                                                                   36/39 
  Verifying  : policycoreutils-2.2.5-20.el7.x86_64                                                                                                                                                                                    37/39 
  Verifying  : libselinux-2.2.2-6.el7.x86_64                                                                                                                                                                                          38/39 
  Verifying  : policycoreutils-python-2.2.5-20.el7.x86_64                                                                                                                                                                             39/39 

Installed:
  docker.x86_64 2:1.12.6-28.git1398f24.el7.centos                                                                                                                                                                                           

Dependency Installed:
  container-selinux.noarch 2:2.12-2.gite7096ce.el7       docker-client.x86_64 2:1.12.6-28.git1398f24.el7.centos       docker-common.x86_64 2:1.12.6-28.git1398f24.el7.centos       oci-register-machine.x86_64 1:0-3.11.gitdd0daef.el7      
  oci-systemd-hook.x86_64 1:0.1.7-2.git2788078.el7       skopeo-containers.x86_64 1:0.1.19-1.el7                     

Updated:
  selinux-policy-targeted.noarch 0:3.13.1-102.el7_3.16                                                                            systemd.x86_64 0:219-30.el7_3.9                                                                           

Dependency Updated:
  libgudev1.x86_64 0:219-30.el7_3.9              libselinux.x86_64 0:2.5-6.el7             libselinux-python.x86_64 0:2.5-6.el7        libselinux-utils.x86_64 0:2.5-6.el7               libsemanage.x86_64 0:2.5-5.1.el7_3              
  libsemanage-python.x86_64 0:2.5-5.1.el7_3      libsepol.x86_64 0:2.5-6.el7               policycoreutils.x86_64 0:2.5-11.el7_3       policycoreutils-python.x86_64 0:2.5-11.el7_3      selinux-policy.noarch 0:3.13.1-102.el7_3.16     
  setools-libs.x86_64 0:3.3.8-1.1.el7            systemd-libs.x86_64 0:219-30.el7_3.9      systemd-python.x86_64 0:219-30.el7_3.9      systemd-sysv.x86_64 0:219-30.el7_3.9             

Complete!
[root@localhost ~]# 

2. docker 시작
service docker start 
[root@localhost ~]# service docker start
Redirecting to /bin/systemctl start  docker.service
[root@localhost ~]# ps -ef|grep docker
root      29129      1  0 11:25 ?        00:00:00 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --selinux-enabled --log-driver=journald --signature-verification=false
root      29146  29129  0 11:25 ?        00:00:00 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --shim docker-containerd-shim --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --runtime docker-runc --runtime-args --systemd-cgroup=true
root      29395   9865  0 11:27 pts/2    00:00:00 grep --color=auto docker
[root@localhost ~]# 

3. 전원 켜기 부팅에 참여
chkconfig docker on
docker에서.io에서 centos를 로컬/var/lib/docker/graph로 다운로드
[root@localhost ~]# chkconfig docker on 
Note: Forwarding request to 'systemctl enable docker.service'.
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@localhost ~]# 

4. 다운로드한 미러 보기
docker images 
[root@localhost ~]# docker images 
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
[root@localhost ~]# 

5. 컨테이너 시작
docker run -i -t centos /bin/bash 
[root@localhost ~]# docker run -i -t centos /bin/bash 
Unable to find image 'centos:latest' locally
Trying to pull repository docker.io/library/centos ... 
latest: Pulling from docker.io/library/centos
d5e46245fe40: Downloading [==>                                                ] 3.244 MB/70.49 MB
^C
[root@localhost ~]# 

6. 모든 컨테이너 보기
docker ps -a 
[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[root@localhost ~]# 

7. 용기 1개 열기
docker start container 

8. 컨테이너의 루트 사용자 비밀번호 보기
docker logs  2>&1 | grep '^User:' | tail -n1 

9. 컨테이너 로그 보기
docker logs -s  

10. 단일 컨테이너 삭제 docker 컨테이너
docker rm loving_ride 

11. 모든 컨테이너 삭제
docker rm $(docker ps -a -q) 

12. docker stop 용기 정지
docker start 

13. 새 용기를 실행하고 이름, 포트 맵, 폴더 맵을 사용합니다.레드마인 렌즈를 예로 들면
docker run --name redmine -p 9003:80 -p 9023:22 -d -v /var/redmine/files:/redmine/files -v/var/redmine/mysql:/var/lib/mysql sameersbn/redmine 

14. 한 용기를 다른 용기 &sonar 용기에 연결하고 mmysql 용기를db로 이름을 바꿉니다.이렇게 하면sonar 용기는db와 관련된 환경 변수를 사용할 수 있습니다.
run -i -t --name sonar -d -link mmysql:dbtpires/sonar-server 

15. 한 기계의 거울을 다른 기계로 옮겨야 할 때 거울을 저장하고 불러와야 한다
docker save > /home/aa.tar 

16. 다른 시스템으로 파일 복사
scp -r /home/aa.tar root@192.168.1.65:/home/aa.tar 

17. 포장된 미러 로드
docker load < /home/aa.tar 

18. 자체 미러링 구축
docker build -t <   > <      >

eg:docker build -t aa/home/aa.tar

좋은 웹페이지 즐겨찾기