您好,登錄后才能下訂單哦!
這篇文章主要介紹“Ubuntu下怎么安裝docker-ce”,在日常操作中,相信很多人在Ubuntu下怎么安裝docker-ce問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”Ubuntu下怎么安裝docker-ce”的疑惑有所幫助!接下來,請跟著小編一起來學(xué)習(xí)吧!
操作系統(tǒng):Ubuntu 18.04.4 LTS
LAN IP :192.168.3.22
Docker是現(xiàn)代軟件開發(fā)和DevOps持續(xù)集成和部署管道中不可或缺的一部分,大部分公司都使用容器化技術(shù),降低服務(wù)器成本。
root@linuxcool:~# apt-get updateroot@linuxcool:~# apt-get -y install apt-transport-https ca-certificates curl software-properties-common
root@linuxcool:~# curl -fsSL https://mirrors.nwafu.edu.cn/docker-ce/linux/ubuntu/gpg | apt-key add -
Docker服務(wù)器在國外,如果使用docker.io來安裝docker會非常慢,有時候還會超時斷開導(dǎo)致無法安裝成功;所以,我這里使用的是國內(nèi)“西北農(nóng)林科技大學(xué)網(wǎng)絡(luò)與教育技術(shù)中心”鏡像加速,國內(nèi)還有很多鏡像加速站點(diǎn),比如:阿里云、騰訊云、網(wǎng)易、清華大學(xué)等,
root@linuxcool:~# apt-get -y updateroot@linuxcool:~# apt-get -y install docker-ce
通過以上命令安裝的是docker最新版本,如果要安裝docker,請繼續(xù)閱讀下文,
查找Docker-CE的版本
apt-cache madison docker-ce docker-ce | 5:19.03.8~3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:19.03.7~3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:19.03.6~3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:19.03.5~3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:19.03.4~3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:19.03.3~3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:19.03.2~3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:19.03.1~3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:19.03.0~3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:18.09.9~3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:18.09.8~3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:18.09.7~3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:18.09.6~3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:18.09.5~3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:18.09.4~3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:18.09.3~3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:18.09.2~3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:18.09.1~3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5:18.09.0~3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 18.06.3~ce~3-0~ubuntu | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 18.06.2~ce~3-0~ubuntu | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 18.06.1~ce~3-0~ubuntu | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 18.06.0~ce~3-0~ubuntu | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 18.03.1~ce~3-0~ubuntu | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages
安裝指定版本的Docker-CE,比如要安裝19.03.8~3-0~ubuntu-bionic
root@linuxcool:~# apt-get -y install docker-ce=19.03.8~3-0~ubuntu-bionic
root@linuxcool:~# docker versionClient: Docker Engine - Community Version: 19.03.8 API version: 1.40 Go version: go1.12.17 Git commit: afacb8b7f0 Built: Wed Mar 11 01:25:46 2020 OS/Arch: linux/amd64 Experimental: falseServer: Docker Engine - Community Engine: Version: 19.03.8 API version: 1.40 (minimum version 1.12) Go version: go1.12.17 Git commit: afacb8b7f0 Built: Wed Mar 11 01:24:19 2020 OS/Arch: linux/amd64 Experimental: falsecontainerd: Version: 1.2.13 GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429 runc: Version: 1.0.0-rc10 GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd docker-init: Version: 0.18.0 GitCommit: fec3683
創(chuàng)建daemon.json配置文件
root@linuxcool:~# vim /etc/docker/daemon.json{ "registry-mirrors": ["https://dockerhub.mirrors.nwafu.edu.cn/"] }
默認(rèn)daemon.json文件不存在,如果daemon.json文件不存在,自己創(chuàng)建
root@linuxcool:~# systemctl daemon-reloadroot@linuxcool:~# systemctl restart docker
root@linuxcool:~# docker infoClient:Debug Mode: falseServer:Containers: 0 Running: 0 Paused: 0 Stopped: 0Images: 0Server Version: 19.03.8Storage Driver: overlay2 Backing Filesystem: Supports d_type: true Native Overlay Diff: trueLogging Driver: json-fileCgroup Driver: cgroupfsPlugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslogSwarm: inactiveRuntimes: runcDefault Runtime: runcInit Binary: docker-initcontainerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429runc version: dc9208a3303feef5b3839f4323d9beb36df0a9ddinit version: fec3683Security Options: apparmor seccomp Profile: defaultKernel Version: 5.3.0-51-genericOperating System: Ubuntu 18.04.4 LTSOSType: linuxArchitecture: x86_64CPUs: 8Total Memory: 15.64GiBName: linuxcoolID: K252:G32L:GWWN:J5FE:3MFZ:2ITG:UE7Y:Y26F:QT3Q:2PLS:HCUX:PJYZDocker Root Dir: /var/lib/dockerDebug Mode: falseRegistry: https://index.docker.io/v1/Labels:Experimental: falseInsecure Registries: 127.0.0.0/8Registry Mirrors: https://dockerhub.mirrors.nwafu.edu.cn/Live Restore Enabled: falseWARNING: No swap limit support
Registry Mirrors默認(rèn)是docker.io,如果看到Registry Mirrors變https://dockerhub.mirrors.nwafu.edu.cn說明配置已經(jīng)生效。
#自啟服務(wù)root@linuxcool:~# systemctl enable docker.service#服務(wù)狀態(tài)root@linuxcool:~# systemctl status docker.service#啟動服務(wù)root@linuxcool:~# systemctl start docker.service#重啟服務(wù)root@linuxcool:~# systemctl restart docker.service#停止服務(wù)root@linuxcool:~# systemctl stop docker.service
root@linuxcool:~# docker pull centos:8.1.19118.1.1911: Pulling from library/centos 8a29a15cefae: Pull complete Digest: sha256:fe8d824220415eed5477b63addf40fb06c3b049404242b31982106ac204f6700 Status: Downloaded newer image for centos:8.1.1911 docker.io/library/centos:8.1.1911
到此,關(guān)于“Ubuntu下怎么安裝docker-ce”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識,請繼續(xù)關(guān)注億速云網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬?shí)用的文章!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。