以前尝试过在centos 6上安装Docker , 需要升级内核,支持aufs,比较麻烦;在使用过程中出现过Docker挂掉的情况,官方建议在64 位 centos 7 上运行,本文将安装步骤记录下来,以便查看:
官方提供了三种安装方式:
1、从 Docker Repositories 安装
2、RPM安装(方便,便捷)
3、脚本安装。
一、本文使用RPM的方式安装:
1> 下载 rpm 包 ,地址:https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
2> 安装 yum install /path/to/package.rpm 注: /path/to/package.rpm 是rpm包下载后的路径及包名
或:以docker-ce-17.06.2.ce-1.el7.centos.x86_64.rpm 为例 , 可以使用:
yum install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-17.06.2.ce-1.el7.centos.x86_64.rpm
3> 启动 Docker systemctl start docker
4> 检验 Docker 是否安装成功 docker run hello-world, 出现如下界面,表示Docker安装成功!
[root@localhost src]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b04784fba78d: Pull complete
Digest: sha256:f3b3b28a45160805bb16542c9531888519430e9e6d6ffc09d72261b0d26ff74f
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:
. The Docker client contacted the Docker daemon.
. The Docker daemon pulled the "hello-world" image from the Docker Hub.
. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
. 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://cloud.docker.com/ For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
二、卸载 Docker 的步骤:
1、卸载 docker 相关的包 yum remove docker-ce
2、删除 docker 相关文件 rm -rf /var/lib/docker