|NO.Z.00003|——————————|^^^^ 部署 ^^^^|——|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.
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
——W.S.Landor
分类:
cdv011-docker
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· DeepSeek 开源周回顾「GitHub 热点速览」