一、安装Docker
♦️ 1.下载关于Docker的依赖环境
在Xterm中输入以下代码安装依赖环境 回车
yum -y install yum-utils device-mapper-persistent-datalvm2
使用yum工具下载
yum是软件包管理工具
通过 执行 man yum
可以查看yum的帮助信息
♦️2.设置一下下载Docker的镜像源
依赖环境下载完毕以后,设置下载的镜像源,如果不设置,会默认去Docker的官方下载,但是官方的服务器在国外,下载会比较缓慢,设置下载国内的镜像源(镜像就是英文单词image)
使用国内的阿里云
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
- 1
♦️3.安装Docker
首先,
下面这个命令是将软件包信息提前在本地缓存一份,用来提高搜索安装软件的速度
yum makecache fast
提高安装速度以后,安装docker相关的。(docker-ce 社区版 而ee是企业版)
yum install docker-ce docker-ce-cli containerd.io
- 1
♦️4.启动,并设置为开机自动启动,测试
4.1 启动Docker服务
systemctl start docker
4.2 设置开机自动启动
systemctl enable docker
4.3 测试
docker run hello-world
如果出现以下代码,说明运行成功:
[root@iZ2ze68ge5c1uwlkmnb9ixZ zcapp]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:0e11c388b664df8a27a901dce21eb89f11d8292f7fca1b3e3c4321bf7897bffe
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
标签:教程,ce,hello,完整,yum,world,docker,Docker
From: https://www.cnblogs.com/py169/p/17963785