在云服务器上安装docker
现在手头有一台云服务器,对其安装docker1.先卸载系统残留的docker# yum remove dockerFailed to set locale, defaulting to CLoaded plugins: fastestmirrorNo Match for argument: dockerNo Packages marked for removal2.安装Doc...
·
现在手头有一台云服务器,对其安装docker
1.先卸载系统残留的docker
# yum remove docker
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
No Match for argument: docker
No Packages marked for removal
2.安装Docker的版本库
# yum install -y yum-utils \
> device-mapper-persistent-data \
> lvm2
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package yum-utils-1.1.31-46.el7_5.noarch already installed and latest version
Package device-mapper-persistent-data-0.7.3-3.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package lvm2.x86_64 7:2.02.177-4.el7 will be installed
--> Processing Dependency: lvm2-libs = 7:2.02.177-4.el7 for package: 7:lvm2-2.02.177-4.el7.x86_64
--> Processing Dependency: liblvm2app.so.2.2(Base)(64bit) for package: 7:lvm2-2.02.177-4.el7.x86_64
--> Processing Dependency: libdevmapper.so.1.02(DM_1_02_141)(64bit) for package: 7:lvm2-2.02.177-4.el7.x86_64
--> Processing Dependency: libdevmapper-event.so.1.02(Base)(64bit) for package: 7:lvm2-2.02.177-4.el7.x86_64
--> Processing Dependency: liblvm2app.so.2.2()(64bit) for package: 7:lvm2-2.02.177-4.el7.x86_64
--> Processing Dependency: libdevmapper-event.so.1.02()(64bit) for package: 7:lvm2-2.02.177-4.el7.x86_64
--> Running transaction check
---> Package device-mapper-event-libs.x86_64 7:1.02.146-4.el7 will be installed
---> Package device-mapper-libs.x86_64 7:1.02.140-8.el7 will be updated
--> Processing Dependency: device-mapper-libs = 7:1.02.140-8.el7 for package: 7:device-mapper-1.02.140-8.el7.x86_64
---> Package device-mapper-libs.x86_64 7:1.02.146-4.el7 will be an update
---> Package lvm2-libs.x86_64 7:2.02.177-4.el7 will be installed
--> Processing Dependency: device-mapper-event = 7:1.02.146-4.el7 for package: 7:lvm2-libs-2.02.177-4.el7.x86_64
--> Running transaction check
---> Package device-mapper.x86_64 7:1.02.140-8.el7 will be updated
---> Package device-mapper.x86_64 7:1.02.146-4.el7 will be an update
---> Package device-mapper-event.x86_64 7:1.02.146-4.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository
Size
================================================================================
Installing:
lvm2 x86_64 7:2.02.177-4.el7 base 1.3 M
Installing for dependencies:
device-mapper-event x86_64 7:1.02.146-4.el7 base 185 k
device-mapper-event-libs x86_64 7:1.02.146-4.el7 base 184 k
lvm2-libs x86_64 7:2.02.177-4.el7 base 1.0 M
Updating for dependencies:
device-mapper x86_64 7:1.02.146-4.el7 base 289 k
device-mapper-libs x86_64 7:1.02.146-4.el7 base 316 k
Transaction Summary
================================================================================
Install 1 Package (+3 Dependent packages)
Upgrade ( 2 Dependent packages)
Total download size: 3.3 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/6): device-mapper-event-1.02.146-4.el7.x86_64.rpm | 185 kB 00:00
(2/6): device-mapper-event-libs-1.02.146-4.el7.x86_64.rpm | 184 kB 00:00
(3/6): device-mapper-1.02.146-4.el7.x86_64.rpm | 289 kB 00:00
(4/6): device-mapper-libs-1.02.146-4.el7.x86_64.rpm | 316 kB 00:00
(5/6): lvm2-2.02.177-4.el7.x86_64.rpm | 1.3 MB 00:00
(6/6): lvm2-libs-2.02.177-4.el7.x86_64.rpm | 1.0 MB 00:00
--------------------------------------------------------------------------------
Total 13 MB/s | 3.3 MB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : 7:device-mapper-libs-1.02.146-4.el7.x86_64 1/8
Updating : 7:device-mapper-1.02.146-4.el7.x86_64 2/8
Installing : 7:device-mapper-event-libs-1.02.146-4.el7.x86_64 3/8
Installing : 7:device-mapper-event-1.02.146-4.el7.x86_64 4/8
Installing : 7:lvm2-libs-2.02.177-4.el7.x86_64 5/8
Installing : 7:lvm2-2.02.177-4.el7.x86_64 6/8
Created symlink from /etc/systemd/system/sysinit.target.wants/lvm2-lvmpolld.socket to /usr/lib/systemd/system/lvm2-lvmpolld.socket.
Cleanup : 7:device-mapper-libs-1.02.140-8.el7.x86_64 7/8
Cleanup : 7:device-mapper-1.02.140-8.el7.x86_64 8/8
Verifying : 7:device-mapper-1.02.146-4.el7.x86_64 1/8
Verifying : 7:device-mapper-event-1.02.146-4.el7.x86_64 2/8
Verifying : 7:device-mapper-event-libs-1.02.146-4.el7.x86_64 3/8
Verifying : 7:lvm2-libs-2.02.177-4.el7.x86_64 4/8
Verifying : 7:lvm2-2.02.177-4.el7.x86_64 5/8
Verifying : 7:device-mapper-libs-1.02.146-4.el7.x86_64 6/8
Verifying : 7:device-mapper-1.02.140-8.el7.x86_64 7/8
Verifying : 7:device-mapper-libs-1.02.140-8.el7.x86_64 8/8
Installed:
lvm2.x86_64 7:2.02.177-4.el7
Dependency Installed:
device-mapper-event.x86_64 7:1.02.146-4.el7
device-mapper-event-libs.x86_64 7:1.02.146-4.el7
lvm2-libs.x86_64 7:2.02.177-4.el7
Dependency Updated:
device-mapper.x86_64 7:1.02.146-4.el7
device-mapper-libs.x86_64 7:1.02.146-4.el7
Complete!
# yum-config-manager \
> --add-repo \
> https://download.docker.com/linux/centos/docker-ce.repo
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
3.安装docker-ce
# yum install docker-ce
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 0:18.06.1.ce-3.el7 will be installed
--> Processing Dependency: container-selinux >= 2.9 for package: docker-ce-18.06.1.ce-3.el7.x86_64
--> Processing Dependency: libcgroup for package: docker-ce-18.06.1.ce-3.el7.x86_64
--> Processing Dependency: libltdl.so.7()(64bit) for package: docker-ce-18.06.1.ce-3.el7.x86_64
--> Running transaction check
---> Package container-selinux.noarch 2:2.68-1.el7 will be installed
--> Processing Dependency: selinux-policy-targeted >= 3.13.1-192 for package: 2:container-selinux-2.68-1.el7.noarch
--> Processing Dependency: selinux-policy-base >= 3.13.1-192 for package: 2:container-selinux-2.68-1.el7.noarch
--> Processing Dependency: selinux-policy >= 3.13.1-192 for package: 2:container-selinux-2.68-1.el7.noarch
--> Processing Dependency: policycoreutils-python for package: 2:container-selinux-2.68-1.el7.noarch
---> Package libcgroup.x86_64 0:0.41-15.el7 will be installed
---> Package libtool-ltdl.x86_64 0:2.4.2-22.el7_3 will be installed
--> Running transaction check
---> Package policycoreutils-python.x86_64 0:2.5-22.el7 will be installed
--> Processing Dependency: policycoreutils = 2.5-22.el7 for package: policycoreutils-python-2.5-22.el7.x86_64
--> Processing Dependency: setools-libs >= 3.3.8-2 for package: policycoreutils-python-2.5-22.el7.x86_64
--> Processing Dependency: libsemanage-python >= 2.5-9 for package: policycoreutils-python-2.5-22.el7.x86_64
--> Processing Dependency: audit-libs-python >= 2.1.3-4 for package: policycoreutils-python-2.5-22.el7.x86_64
--> Processing Dependency: python-IPy for package: policycoreutils-python-2.5-22.el7.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.4)(64bit) for package: policycoreutils-python-2.5-22.el7.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.2)(64bit) for package: policycoreutils-python-2.5-22.el7.x86_64
--> Processing Dependency: libapol.so.4(VERS_4.0)(64bit) for package: policycoreutils-python-2.5-22.el7.x86_64
--> Processing Dependency: checkpolicy for package: policycoreutils-python-2.5-22.el7.x86_64
--> Processing Dependency: libqpol.so.1()(64bit) for package: policycoreutils-python-2.5-22.el7.x86_64
--> Processing Dependency: libapol.so.4()(64bit) for package: policycoreutils-python-2.5-22.el7.x86_64
---> Package selinux-policy.noarch 0:3.13.1-166.el7_4.4 will be updated
---> Package selinux-policy.noarch 0:3.13.1-192.el7_5.6 will be an update
---> Package selinux-policy-targeted.noarch 0:3.13.1-166.el7_4.4 will be updated
---> Package selinux-policy-targeted.noarch 0:3.13.1-192.el7_5.6 will be an update
--> Running transaction check
---> Package audit-libs-python.x86_64 0:2.8.1-3.el7_5.1 will be installed
--> Processing Dependency: audit-libs(x86-64) = 2.8.1-3.el7_5.1 for package: audit-libs-python-2.8.1-3.el7_5.1.x86_64
---> Package checkpolicy.x86_64 0:2.5-6.el7 will be installed
---> Package libsemanage-python.x86_64 0:2.5-11.el7 will be installed
--> Processing Dependency: libsemanage = 2.5-11.el7 for package: libsemanage-python-2.5-11.el7.x86_64
---> Package policycoreutils.x86_64 0:2.5-17.1.el7 will be updated
---> Package policycoreutils.x86_64 0:2.5-22.el7 will be an update
--> Processing Dependency: libsepol >= 2.5-8 for package: policycoreutils-2.5-22.el7.x86_64
--> Processing Dependency: libselinux-utils >= 2.5-12 for package: policycoreutils-2.5-22.el7.x86_64
---> Package python-IPy.noarch 0:0.75-6.el7 will be installed
---> Package setools-libs.x86_64 0:3.3.8-2.el7 will be installed
--> Processing Dependency: libselinux >= 2.5-12 for package: setools-libs-3.3.8-2.el7.x86_64
--> Running transaction check
---> Package audit-libs.x86_64 0:2.7.6-3.el7 will be updated
--> Processing Dependency: audit-libs(x86-64) = 2.7.6-3.el7 for package: audit-2.7.6-3.el7.x86_64
---> Package audit-libs.x86_64 0:2.8.1-3.el7_5.1 will be an update
---> Package libselinux.x86_64 0:2.5-11.el7 will be updated
--> Processing Dependency: libselinux(x86-64) = 2.5-11.el7 for package: libselinux-python-2.5-11.el7.x86_64
---> Package libselinux.x86_64 0:2.5-12.el7 will be an update
---> Package libselinux-utils.x86_64 0:2.5-11.el7 will be updated
---> Package libselinux-utils.x86_64 0:2.5-12.el7 will be an update
---> Package libsemanage.x86_64 0:2.5-8.el7 will be updated
---> Package libsemanage.x86_64 0:2.5-11.el7 will be an update
---> Package libsepol.x86_64 0:2.5-6.el7 will be updated
---> Package libsepol.x86_64 0:2.5-8.1.el7 will be an update
--> Running transaction check
---> Package audit.x86_64 0:2.7.6-3.el7 will be updated
---> Package audit.x86_64 0:2.8.1-3.el7_5.1 will be an update
---> Package libselinux-python.x86_64 0:2.5-11.el7 will be updated
---> Package libselinux-python.x86_64 0:2.5-12.el7 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
docker-ce x86_64 18.06.1.ce-3.el7 docker-ce-stable 41 M
Installing for dependencies:
audit-libs-python x86_64 2.8.1-3.el7_5.1 updates 75 k
checkpolicy x86_64 2.5-6.el7 base 294 k
container-selinux noarch 2:2.68-1.el7 extras 36 k
libcgroup x86_64 0.41-15.el7 base 65 k
libsemanage-python x86_64 2.5-11.el7 base 112 k
libtool-ltdl x86_64 2.4.2-22.el7_3 base 49 k
policycoreutils-python x86_64 2.5-22.el7 base 454 k
python-IPy noarch 0.75-6.el7 base 32 k
setools-libs x86_64 3.3.8-2.el7 base 619 k
Updating for dependencies:
audit x86_64 2.8.1-3.el7_5.1 updates 247 k
audit-libs x86_64 2.8.1-3.el7_5.1 updates 99 k
libselinux x86_64 2.5-12.el7 base 162 k
libselinux-python x86_64 2.5-12.el7 base 235 k
libselinux-utils x86_64 2.5-12.el7 base 151 k
libsemanage x86_64 2.5-11.el7 base 150 k
libsepol x86_64 2.5-8.1.el7 base 297 k
policycoreutils x86_64 2.5-22.el7 base 867 k
selinux-policy noarch 3.13.1-192.el7_5.6 updates 453 k
selinux-policy-targeted noarch 3.13.1-192.el7_5.6 updates 6.6 M
Transaction Summary
================================================================================
Install 1 Package (+ 9 Dependent packages)
Upgrade ( 10 Dependent packages)
Total size: 52 M
Total download size: 41 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/docker-ce-18.06.1.ce-3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Public key for docker-ce-18.06.1.ce-3.el7.x86_64.rpm is not installed
docker-ce-18.06.1.ce-3.el7.x86_64.rpm | 41 MB 00:08
Retrieving key from https://download.docker.com/linux/centos/gpg
Importing GPG key 0x621E9F35:
Userid : "Docker Release (CE rpm) <docker@docker.com>"
Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
From : https://download.docker.com/linux/centos/gpg
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : libsepol-2.5-8.1.el7.x86_64 1/30
Updating : libselinux-2.5-12.el7.x86_64 2/30
Updating : audit-libs-2.8.1-3.el7_5.1.x86_64 3/30
Updating : libsemanage-2.5-11.el7.x86_64 4/30
Updating : libselinux-utils-2.5-12.el7.x86_64 5/30
Updating : policycoreutils-2.5-22.el7.x86_64 6/30
Updating : selinux-policy-3.13.1-192.el7_5.6.noarch 7/30
Installing : libcgroup-0.41-15.el7.x86_64 8/30
Updating : selinux-policy-targeted-3.13.1-192.el7_5.6.noarch 9/30
Installing : libsemanage-python-2.5-11.el7.x86_64 10/30
Installing : audit-libs-python-2.8.1-3.el7_5.1.x86_64 11/30
Updating : libselinux-python-2.5-12.el7.x86_64 12/30
Installing : setools-libs-3.3.8-2.el7.x86_64 13/30
Installing : checkpolicy-2.5-6.el7.x86_64 14/30
Installing : libtool-ltdl-2.4.2-22.el7_3.x86_64 15/30
Installing : python-IPy-0.75-6.el7.noarch 16/30
Installing : policycoreutils-python-2.5-22.el7.x86_64 17/30
Installing : 2:container-selinux-2.68-1.el7.noarch 18/30
setsebool: SELinux is disabled.
Installing : docker-ce-18.06.1.ce-3.el7.x86_64 19/30
Updating : audit-2.8.1-3.el7_5.1.x86_64 20/30
Cleanup : selinux-policy-targeted-3.13.1-166.el7_4.4.noarch 21/30
Cleanup : selinux-policy-3.13.1-166.el7_4.4.noarch 22/30
Cleanup : policycoreutils-2.5-17.1.el7.x86_64 23/30
Cleanup : libsemanage-2.5-8.el7.x86_64 24/30
Cleanup : libselinux-utils-2.5-11.el7.x86_64 25/30
Cleanup : audit-2.7.6-3.el7.x86_64 26/30
Cleanup : libselinux-python-2.5-11.el7.x86_64 27/30
Cleanup : libselinux-2.5-11.el7.x86_64 28/30
Cleanup : libsepol-2.5-6.el7.x86_64 29/30
Cleanup : audit-libs-2.7.6-3.el7.x86_64 30/30
Verifying : libsemanage-python-2.5-11.el7.x86_64 1/30
Verifying : libsemanage-2.5-11.el7.x86_64 2/30
Verifying : libselinux-python-2.5-12.el7.x86_64 3/30
Verifying : setools-libs-3.3.8-2.el7.x86_64 4/30
Verifying : audit-libs-python-2.8.1-3.el7_5.1.x86_64 5/30
Verifying : 2:container-selinux-2.68-1.el7.noarch 6/30
Verifying : policycoreutils-2.5-22.el7.x86_64 7/30
Verifying : audit-2.8.1-3.el7_5.1.x86_64 8/30
Verifying : policycoreutils-python-2.5-22.el7.x86_64 9/30
Verifying : python-IPy-0.75-6.el7.noarch 10/30
Verifying : libtool-ltdl-2.4.2-22.el7_3.x86_64 11/30
Verifying : selinux-policy-targeted-3.13.1-192.el7_5.6.noarch 12/30
Verifying : libcgroup-0.41-15.el7.x86_64 13/30
Verifying : docker-ce-18.06.1.ce-3.el7.x86_64 14/30
Verifying : audit-libs-2.8.1-3.el7_5.1.x86_64 15/30
Verifying : libsepol-2.5-8.1.el7.x86_64 16/30
Verifying : libselinux-2.5-12.el7.x86_64 17/30
Verifying : libselinux-utils-2.5-12.el7.x86_64 18/30
Verifying : selinux-policy-3.13.1-192.el7_5.6.noarch 19/30
Verifying : checkpolicy-2.5-6.el7.x86_64 20/30
Verifying : libselinux-2.5-11.el7.x86_64 21/30
Verifying : libselinux-utils-2.5-11.el7.x86_64 22/30
Verifying : selinux-policy-3.13.1-166.el7_4.4.noarch 23/30
Verifying : audit-libs-2.7.6-3.el7.x86_64 24/30
Verifying : audit-2.7.6-3.el7.x86_64 25/30
Verifying : libsepol-2.5-6.el7.x86_64 26/30
Verifying : policycoreutils-2.5-17.1.el7.x86_64 27/30
Verifying : libsemanage-2.5-8.el7.x86_64 28/30
Verifying : libselinux-python-2.5-11.el7.x86_64 29/30
Verifying : selinux-policy-targeted-3.13.1-166.el7_4.4.noarch 30/30
Installed:
docker-ce.x86_64 0:18.06.1.ce-3.el7
Dependency Installed:
audit-libs-python.x86_64 0:2.8.1-3.el7_5.1
checkpolicy.x86_64 0:2.5-6.el7
container-selinux.noarch 2:2.68-1.el7
libcgroup.x86_64 0:0.41-15.el7
libsemanage-python.x86_64 0:2.5-11.el7
libtool-ltdl.x86_64 0:2.4.2-22.el7_3
policycoreutils-python.x86_64 0:2.5-22.el7
python-IPy.noarch 0:0.75-6.el7
setools-libs.x86_64 0:3.3.8-2.el7
Dependency Updated:
audit.x86_64 0:2.8.1-3.el7_5.1
audit-libs.x86_64 0:2.8.1-3.el7_5.1
libselinux.x86_64 0:2.5-12.el7
libselinux-python.x86_64 0:2.5-12.el7
libselinux-utils.x86_64 0:2.5-12.el7
libsemanage.x86_64 0:2.5-11.el7
libsepol.x86_64 0:2.5-8.1.el7
policycoreutils.x86_64 0:2.5-22.el7
selinux-policy.noarch 0:3.13.1-192.el7_5.6
selinux-policy-targeted.noarch 0:3.13.1-192.el7_5.6
Complete!
4.验证安装状态
# docker -v
Docker version 18.06.1-ce, build e68fc7a
5.查看当前docker的状态
# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: https://docs.docker.com
6.启动docker
# systemctl start docker
7.验证是否启动成功
# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2018-10-31 13:44:32 CST; 30s ago
Docs: https://docs.docker.com
Main PID: 1641 (dockerd)
Memory: 46.0M
CGroup: /system.slice/docker.service
├─1641 /usr/bin/dockerd
└─1647 docker-containerd --config /var/run/docker/containerd/conta...
Oct 31 13:44:31 iz2zeaisea6jr1xtcmx33tz dockerd[1641]: time="2018-10-31T13:44...
Oct 31 13:44:31 iz2zeaisea6jr1xtcmx33tz dockerd[1641]: time="2018-10-31T13:44...
Oct 31 13:44:31 iz2zeaisea6jr1xtcmx33tz dockerd[1641]: time="2018-10-31T13:44...
Oct 31 13:44:32 iz2zeaisea6jr1xtcmx33tz dockerd[1641]: time="2018-10-31T13:44...
Oct 31 13:44:32 iz2zeaisea6jr1xtcmx33tz dockerd[1641]: time="2018-10-31T13:44...
Oct 31 13:44:32 iz2zeaisea6jr1xtcmx33tz dockerd[1641]: time="2018-10-31T13:44...
Oct 31 13:44:32 iz2zeaisea6jr1xtcmx33tz dockerd[1641]: time="2018-10-31T13:44...
Oct 31 13:44:32 iz2zeaisea6jr1xtcmx33tz dockerd[1641]: time="2018-10-31T13:44...
Oct 31 13:44:32 iz2zeaisea6jr1xtcmx33tz dockerd[1641]: time="2018-10-31T13:44...
Oct 31 13:44:32 iz2zeaisea6jr1xtcmx33tz systemd[1]: Started Docker Applicatio...
Hint: Some lines were ellipsized, use -l to show in full.
更多推荐
已为社区贡献2条内容
所有评论(0)