# Docker 安装
# 一、Mac
直接官网:https://www.docker.com/get-started
# 二、Linux
1. 移除旧版本
yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine
2. 安装 Docker 依赖工具
yum install -y device-mapper-persistent-data lvm2
3. 下载 Docker
yum -y install docker
4. 启动 Docker 后台服务
systemctl start docker
5. 运行测试 hello-world
docker run hello-world
由于本地没有 hello-world 这个镜像,所以会下载一个hello-world 的镜像,并在容器内运行。若能正常输出信息,则说明安装成功。
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
256ab8fe8778: Pull complete
Digest: sha256:7f0a9f93b4aa3022c3a4c147a449bf11e0941a1fd0bf4a8e6c9408b2600777c5
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
.....
.....
.....
6. 查看下载的 hello-world 镜像
docker images
输出:
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest a29f45ccde2a 5 seconds ago 9.14kB