以前嘗試過在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: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 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://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