安装Docker
环境准备
1、需要会一点点linux基础
2、Centos7
3、MobaXterm_Personal_20.6(远程工具)
环境查看
#系统内核是3.10以上的
[root@liuyang ~]# uname -r
3.10.0-1160.11.1.el7.x86_64
#系统版本
[root@liuyang ~]# 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"
安装
帮助文档:
#1、卸载旧版本
$ sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
#2、需要的安装包
[root@liuyang ~]# yum install -y yum-utils
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package yum-utils-1.1.31-54.el7_8.noarch already installed and latest version
Nothing to do
#3、设置镜像的仓库
推荐使用阿里云的:
yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
#更新yum软件包索引
yum makecache fast
#4、安装docker相关内容
yum install docker-ce docker-ce-cli containerd.io
#5、启动docker
systemctl start docker
#6、判断安装成功

最后:
docker run hello-world一下

解读一下:
[root@liuyang ~]# docker run hello-world
//没有找到镜像hello-world
Unable to find image 'hello-world:latest' locally
//去远程pull一下hello-world
latest: Pulling from library/hello-world
0e03bdcc26d7: Already exists
//打标签
Digest: sha256:31b9c7d48790f0d8c50ab433d9c3b7e17666d6993084c002c2ff1ca09b96391d
Status: Downloaded newer image for hello-world:latest
//证明运行成功了
Hello from Docker!
此处使用docker images 可以看到我们刚刚运行的hello-world镜像
``
卸载docker
1、卸载依赖
yum remove docker-ce docker-ce-cli containerd.io
2、主机上的映像,容器,卷或自定义配置文件不会自动删除。要删除所有图像,容器和卷:
rm -rf /var/lib/docker (docker的默认路径)
834

被折叠的 条评论
为什么被折叠?



