CC00003.CloudDocker——|Cloud&Docker.V01|——|docker.rpm部署|

一、docker安装的三种方式(install for linux):
### --- docker安装的三种方式(install for linux):

~~~     script:脚本的方式;
~~~     yum:yum方式安装;
~~~     rpm:rpm包安装(推荐使用)
二、docker部署
### --- 方式一:script install

[root@localhost ~]# yum update
[root@localhost ~]# curl -sSL https://get.docker.com/ | sh
[root@localhost ~]# systemctl start docker
[root@localhost ~]# systemctl enable docker
[root@localhost ~]# docker run hello-world
### --- 方式二:yum install

[root@localhost ~]# yum update
[root@localhost ~]# cat >/etc/yum.repos.d/docker.repo <<-EOF
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg EOF
[root@localhost ~]# yum install docker
### --- 方式三:rpm install 

https://download.docker.com/linux/centos/7/x86_64/stable/Packages
三、通过rpm安装docker服务
### --- rpm包下载:

~~~     # 地址:https://download.docker.com/linux/centos/7/x86_64/stable/Packages
~~~     # 下载:docker-ce-17.03.0.ce-1.el7.centos.x86_64.rpm
~~~     # docker-selinux:docker-ce-selinux-17.03.0.ce-1.el7.centos.noarch.rpm
### --- 环境检查:

[root@localhost ~]# getenforce
Disabled
[root@localhost ~]# systemctl status firewalld.service 
[root@localhost ~]# yum install -y iptables-services
[root@localhost ~]# systemctl start  iptables.service 
[root@localhost ~]# systemctl enable iptables.service 
[root@localhost ~]# iptables -F                         // 清空防火墙默认规则
[root@localhost ~]# service iptables save               // 保存防火墙规则
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
[root@localhost ~]# yum update                          // 更新软件包

[root@localhost docker]# ls
docker-ce-17.03.0.ce-1.el7.centos.x86_64.rpm
docker-ce-selinux-17.03.0.ce-1.el7.centos.noarch.rpm
### --- 安装docker rpm包和selinux包

[root@localhost docker]# yum install -y *               
Installed:
  docker-ce.x86_64 0:17.03.0.ce-1.el7.centos                docker-ce-selinux.noarch 0:17.03.0.ce-1.el7.centos                                           
Dependency Installed:
  audit-libs-python.x86_64 0:2.8.5-4.el7        checkpolicy.x86_64 0:2.5-8.el7                    libcgroup.x86_64 0:0.41-21.el7        libsemanage-python.x86_64 0:2.5-14.el7       
  libtool-ltdl.x86_64 0:2.4.2-22.el7_3          policycoreutils-python.x86_64 0:2.5-34.el7        python-IPy.noarch 0:0.75-6.el7        setools-libs.x86_64 0:3.3.8-4.el7            
Complete!
root@localhost docker]# systemctl start docker.service 
[root@localhost docker]# systemctl enable docker.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
### --- 测试hello-world容器

[root@localhost docker]# docker run hello-world         
Unable to find image 'hello-world:latest' locally       // hello-world镜像名称:latest版本号v1/v2/v3版本号,若不加版本号,默认latest:代表最新稳定版
latest: Pulling from library/hello-world                // pulling下载镜像hello-world镜像
0e03bdcc26d7: Pull complete 
Digest: sha256:1a523af650137b8accdaed439c17d684df61ee4d74feac151b5b337bd29e7eec
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yanqi_vip

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值