您好,登錄后才能下訂單哦!
這篇文章給大家分享的是有關ununtu如何安裝Docker CE的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。
docker 安裝前準備-操作系統列表需要滿足如下版本的ubuntu
Cosmic 18.10
Bionic 18.04 (LTS)
Xenial 16.04 (LTS)
卸載舊版本docker,如果安裝過的請操作如下,如果使用普通賬號執行,請按如下操作,如果有root權限請忽略sudo,系統首次安裝請略過此步驟
$ sudo apt-get remove docker docker-engine docker.io containerd runc
安裝docker ce
1.設置倉庫
$ sudo apt-get update
2. 安裝包允許apt通過HTTPS使用存儲庫
$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
3. 添加Docker的官方GPG密鑰
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
4.驗證秘鑰
$ sudo apt-key fingerprint 0EBFCD88
有如下顯示:證明安裝成功
pub rsa4096 2017-02-22 [SCEA] 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 uid [ unknown] Docker Release (CE deb) <docker@docker.com> sub rsa4096 2017-02-22 [S]
5.安裝穩定版倉庫
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
6.安裝docker ce
#更新apt包索引 $ sudo apt-get update
7.安裝最新版本docker ce或者跳到下步安裝指定版本
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
8.安裝指定版本的docker ce
$ apt-cache madison docker-ce docker-ce | 5:18.09.6~3-0~ubuntu-bionic | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:18.09.5~3-0~ubuntu-bionic | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:18.09.4~3-0~ubuntu-bionic | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:18.09.3~3-0~ubuntu-bionic | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:18.09.2~3-0~ubuntu-bionic | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:18.09.1~3-0~ubuntu-bionic | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:18.09.0~3-0~ubuntu-bionic | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 18.06.3~ce~3-0~ubuntu | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 18.06.2~ce~3-0~ubuntu | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 18.06.1~ce~3-0~ubuntu | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 18.06.0~ce~3-0~ubuntu | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 18.03.1~ce~3-0~ubuntu | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu bionic/stable amd64 Packages
以5:18.09.6~3-0~ubuntu-bionic版本為例,執行如下命令
$ sudo apt-get install docker-ce=5:18.09.6~3-0~ubuntu-bionic docker-ce-cli=5:18.09.6~3-0~ubuntu-bionic containerd.io
9.運行測試實例,hello-world鏡像,如果沒有該鏡像會自動下載
$ sudo docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 1b930d010525: Pull complete Digest: sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8 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/
介紹下卸載docker ce
1.卸載docker ce
$ sudo apt-get purge docker-ce
2. 主機上的映像、容器、卷或自定義配置文件不會自動刪除。刪除所有圖像、容器和卷
$ sudo rm -rf /var/lib/docker
感謝各位的閱讀!關于“ununtu如何安裝Docker CE”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。