docker简介与安装卸载

一,Docker和虚拟机对比

二,docker的优势

三,docker的安装

---查看系统版本命令

[root@localhost /]# cat /etc/os-release

NAME="CentOS Linux"

VERSION="7 (Core)"

ID="centos"

ID_LIKE="rhel fedora"

VERSION_ID="7"

PRETTY_NAME="CentOS Linux 7 (Core)"

ANSI_COLOR="0;31"

CPE_NAME="cpe:/o:centos:centos:7"

HOME_URL="https://www.centos.org/"

BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"

CENTOS_MANTISBT_PROJECT_VERSION="7"

REDHAT_SUPPORT_PRODUCT="centos"

REDHAT_SUPPORT_PRODUCT_VERSION="7"

---查看系统内核命令

[root@localhost /]# uname -r

3.10.0-1160.el7.x86_64

--------------------------------安装开始----------------------

#关闭并禁用防火墙

systemctl stop firewalld

systemctl disable firewalld

#停用并禁用selinux

setenforce 0

sed -ri s'#(SELINUX=)enforcing#\1disabled#' /etc/selinux/config

1,卸载旧的版本

yum -y remove docker*

2,需要的安装依赖包

yum install -y yum-utils

3,设置镜像的仓库

---# 默认是从国外的!非常慢

yum-config-manager \

--add-repo \

https://download.docker.com/1mux/centos/docker-ce.repo

---阿里云镜像安装更快捷----用这个---------------

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

---安装成功

4,更新yum软件包索引

yum makecache fast

5,安装dokcer相关|Idocker-ce 社区ee 企业版

yum -y install docker-ce docker-ce-cli containerd.io # 安装docker

yum install -y docker-ce-20.10.0 docker-ce-cli-20.10.0 containerd.io # 指定版本

systemctl enable docker && systemctl start docker  # 设置开机启动

------------------设置镜像加速器------------------

cat <<EOF> /etc/docker/daemon.json

{         

"exec-opts": ["native.cgroupdriver=systemd"],         

"registry-mirrors": ["https://kn0t2bca.mirror.aliyuncs.com"]

 }

EOF

---------------------------------------------------------

6,启动docker

systemctl restart docker ---启动docker

docker version ---查看docker版本

7,使用docker run hello-world  验证是否安装成功

8,docker images

9,卸载docker

# 1、卸戟依赖

yum remove docker-ce docker-ce-cli containerd.io

# 2、刚除资源

rm -rf /var/lib/docker

=======================================================================================

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

兰博的进化之旅

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

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

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

打赏作者

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

抵扣说明:

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

余额充值