記錄下在CentOS7中安裝Docker CE 1. 卸載系統(tǒng)中可能存在的老版本 在CentOS中,老版本Docker的軟件包名是docker或docker-engine,而Docker CE的軟件包名稱是docker-ce。因此,若已安裝過老版本的Docker,需使用如下命令卸載 需要注意的是,執(zhí)行該命令只會卸載Docker本身,不會刪除Docker存儲的文件,例如鏡像、容器、卷以及網(wǎng)絡(luò)文件等。這些文件保存在/var/lib/docker目錄中,需要手動刪除。
2. 開始安裝docker CE
復(fù)制執(zhí)行以下命令,安裝Docker所需的包。其中: 復(fù)制執(zhí)行如下命令,安裝stable倉庫。必須安裝stable倉庫,即使你想安裝edge或test倉庫中的Docker構(gòu)建版本。 [可選]執(zhí)行如下命令,啟用edge及test倉庫。edge/test倉庫中其實也包含在了docker.repo文件中,但默認(rèn)是禁用的,可使用以下命令啟用 復(fù)制執(zhí)行以下命令,更新yum的包索引 復(fù)制執(zhí)行如下命令即可安裝最新版本的Docker CE 啟動docker 驗證安裝是否正確 Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete
Digest: sha256:7d91b69e04a9029b99f3585aaaccae2baa80bcf318f4a5d2165a9898cd2dc0a1
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./For more examples and ideas, visit:
https://docs./get-started/
使用腳本來安裝Dockers
|