centos7安裝 docker

  • centos7安裝 docker

 

切換到 root用戶,執行:python

[root@localhost frinder]# yum install docker
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
正在解決依賴關係
--> 正在檢查事務
--> 解決依賴關係完成linux

依賴關係解決git

=================================================================================================================================================================
Package 架構 版本 源 大小
=================================================================================================================================================================
正在安裝:
docker x86_64 2:1.12.6-11.el7.centos extras 20 M
爲依賴而安裝:
container-selinux noarch 2:2.9-4.el7 extras 26 k
docker-client x86_64 2:1.12.6-11.el7.centos extras 4.4 M
docker-common x86_64 2:1.12.6-11.el7.centos extras 71 k
oci-register-machine x86_64 1:0-1.11.gitdd0daef.el7 extras 1.1 M
oci-systemd-hook x86_64 1:0.1.4-9.git671c428.el7 extras 29 k
skopeo-containers x86_64 1:0.1.18-1.el7 extras 7.6 kdocker

事務概要
=================================================================================================================================================================
安裝 1 軟件包 (+6 依賴軟件包)shell

總下載量:26 M
安裝大小:104 M
Is this ok [y/d/N]: y
Downloading packages:
警告:/var/cache/yum/x86_64/7/extras/packages/container-selinux-2.9-4.el7.noarch.rpm: 頭V3 RSA/SHA256 Signature, 密鑰 ID f4a80eb5: NOKEY
container-selinux-2.9-4.el7.noarch.rpm 的公鑰還沒有安裝
(1/7): container-selinux-2.9-4.el7.noarch.rpm | 26 kB 00:00:00
(2/7): docker-client-1.12.6-11.el7.centos.x86_64.rpm | 4.4 MB 00:00:04
(3/7): docker-common-1.12.6-11.el7.centos.x86_64.rpm | 71 kB 00:00:00
(4/7): oci-register-machine-0-1.11.gitdd0daef.el7.x86_64.rpm | 1.1 MB 00:00:01
(5/7): oci-systemd-hook-0.1.4-9.git671c428.el7.x86_64.rpm | 29 kB 00:00:00
(6/7): skopeo-containers-0.1.18-1.el7.x86_64.rpm | 7.6 kB 00:00:00
(7/7): docker-1.12.6-11.el7.centos.x86_64.rpm | 20 MB 00:00:13
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
總計 1.9 MB/s | 26 MB 00:00:13
從 http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 檢索密鑰
導入 GPG key 0xF4A80EB5:
用戶ID : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
指紋 : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
來自 : http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
是否繼續?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安裝 : 2:docker-common-1.12.6-11.el7.centos.x86_64 1/7
正在安裝 : 2:docker-client-1.12.6-11.el7.centos.x86_64 2/7
正在安裝 : 1:oci-systemd-hook-0.1.4-9.git671c428.el7.x86_64 3/7
正在安裝 : 1:oci-register-machine-0-1.11.gitdd0daef.el7.x86_64 4/7
正在安裝 : 1:skopeo-containers-0.1.18-1.el7.x86_64 5/7
正在安裝 : 2:container-selinux-2.9-4.el7.noarch 6/7
正在安裝 : 2:docker-1.12.6-11.el7.centos.x86_64 7/7
驗證中 : 2:container-selinux-2.9-4.el7.noarch 1/7
驗證中 : 2:docker-1.12.6-11.el7.centos.x86_64 2/7
驗證中 : 1:skopeo-containers-0.1.18-1.el7.x86_64 3/7
驗證中 : 1:oci-register-machine-0-1.11.gitdd0daef.el7.x86_64 4/7
驗證中 : 2:docker-common-1.12.6-11.el7.centos.x86_64 5/7
驗證中 : 2:docker-client-1.12.6-11.el7.centos.x86_64 6/7
驗證中 : 1:oci-systemd-hook-0.1.4-9.git671c428.el7.x86_64 7/7 centos

已安裝:
docker.x86_64 2:1.12.6-11.el7.centos bash

做爲依賴被安裝:
container-selinux.noarch 2:2.9-4.el7 docker-client.x86_64 2:1.12.6-11.el7.centos docker-common.x86_64 2:1.12.6-11.el7.centos
oci-register-machine.x86_64 1:0-1.11.gitdd0daef.el7 oci-systemd-hook.x86_64 1:0.1.4-9.git671c428.el7 skopeo-containers.x86_64 1:0.1.18-1.el7 架構

完畢!ui

 

啓動 docker,執行:
[root@localhost frinder]# systemctl start docker.servicethis

將 docker設置開機啓動:
[root@localhost frinder]# systemctl enable docker.service
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

 

下載 docker使用 Centos鏡像,下載有點慢,耐心等待:
[root@localhost docker]# docker pull centos
Using default tag: latest
Trying to pull repository docker.io/library/centos ...
latest: Pulling from docker.io/library/centos
93857f76ae30: Pull complete
Digest: sha256:4eda692c08e0a065ae91d74e82fff4af3da307b4341ad61fa61771cc4659af60


查看下載鏡像:
[root@localhost docker]# docker images centos
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/centos latest a8493f5f50ff 3 days ago 192.5 MB


使用 docker啓動一個容器,啓動成功會自動切換到臨時容器 54d23ded3cd1:
[root@localhost docker]# docker run -i -t docker.io/centos /bin/bash
[root@54d23ded3cd1 /]#

[root@54d23ded3cd1 /]# ls /etc BUILDTIME chkconfig.d gnupg issue.net modules-load.d popt.d rc5.d shells vircDIR_COLORS crypttab group krb5.conf motd prelink.conf.d rc6.d skel xdgDIR_COLORS.256color csh.cshrc group- krb5.conf.d mtab printcap redhat-release ssl xinetd.dDIR_COLORS.lightbgcolor csh.login gshadow ld.so.cache nsswitch.conf profile resolv.conf subgid yumGREP_COLORS dbus-1 gshadow- ld.so.conf nsswitch.conf.bak profile.d rpc subuid yum.confX11 default gss ld.so.conf.d openldap protocols rpm sysconfig yum.repos.dadjtime.rpmsave depmod.d host.conf libaudit.conf opt python rsyslog.d sysctl.daliases dracut.conf hostname libuser.conf os-release rc.d sasl2 system-releasealternatives dracut.conf.d hosts locale.conf pam.d rc.local securetty system-release-cpebash_completion.d environment hosts.allow localtime passwd rc0.d security systemdbashrc exports hosts.deny login.defs passwd- rc1.d selinux terminfobinfmt.d filesystems init.d logrotate.d pkcs11 rc2.d services tmpfiles.dcentos-release fstab inputrc machine-id pki rc3.d shadow udevcentos-release-upstream gcrypt issue modprobe.d pm rc4.d shadow- vconsole.conf[root@54d23ded3cd1 /]# cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core) [root@54d23ded3cd1 /]# exit

相關文章
相關標籤/搜索