Docker是什麼,有什麼優勢缺點,網上一堆資料,這裏不進行贅述,直接實操。linux
查看系統版本號方法docker
uname -a
Linux dell-PowerEdge-R440 5.0.0-37-generic #40~18.04.1-Ubuntu SMP Thu Nov 14 12:06:39 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
複製代碼
不管在何時,官方的文檔仍是最權威的,別人的經驗當然可讓人少走不少彎路,可是仍是得養成閱讀官方文檔的習慣官方安裝指導請戳我數據庫
能夠對着官網一個一個檢查一下,我這個是新機器因此無需作額外的檢查,咱們直接進入正題ubuntu
Ubuntu下安裝Docker有兩種方式bash
其中apt方式安裝最爲簡單,手動敲入幾個命令便可,可是因爲Docker鏡像服務器在國外,我第一次就是沒有配置任何鏡像加速器的狀況下直接使用 apt-get install 安裝的,那個等待時間叫一個久啊,因此我這裏推薦小夥伴門直接下載鏡像文件安裝,文件下載地址請戳我,依次選擇 xenial/pool/stable/amd64/,須要下載三個文件,下載完成以後能夠上傳到服務器,須要下載的文件以下:服務器
ll
-rw-rw-r-- 1 surging surging 22610446 6月 22 11:51 containerd.io_1.2.6-3_amd64.deb
-rw-rw-r-- 1 surging surging 22445356 6月 22 11:51 docker-ce_19.03.9_3-0_ubuntu-xenial_amd64.deb
-rw-rw-r-- 1 surging surging 41226320 6月 22 11:51 docker-ce-cli_19.03.9_3-0_ubuntu-xenial_amd64.deb
複製代碼
依次安裝containerd.io_1.2.6-3_amd64.deb、docker-ce-cli_19.03.9_3-0_ubuntu-xenial_amd64.deb、docker-ce_19.03.9_3-0_ubuntu-xenial_amd64.debapp
sudo dpkg -i containerd.io_1.2.6-3_amd64.deb
正在選中未選擇的軟件包 containerd.io。
(正在讀取數據庫 ... 系統當前共安裝有 205848 個文件和目錄。)
正準備解包 containerd.io_1.2.6-3_amd64.deb ...
正在解包 containerd.io (1.2.6-3) ...
正在設置 containerd.io (1.2.6-3) ...
Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /lib/systemd/system/containerd.service.
複製代碼
sudo dpkg -i docker-ce-cli_19.03.9_3-0_ubuntu-xenial_amd64.deb
正在選中未選擇的軟件包 docker-ce-cli。
(正在讀取數據庫 ... 系統當前共安裝有 205869 個文件和目錄。)
正準備解包 docker-ce-cli_19.03.9_3-0_ubuntu-xenial_amd64.deb ...
正在解包 docker-ce-cli (5:19.03.9~3-0~ubuntu-xenial) ...
正在設置 docker-ce-cli (5:19.03.9~3-0~ubuntu-xenial) ...
正在處理用於 man-db (2.8.3-2ubuntu0.1) 的觸發器 ...
複製代碼
sudo dpkg -i docker-ce_19.03.9_3-0_ubuntu-xenial_amd64.deb
(正在讀取數據庫 ... 系統當前共安裝有 206074 個文件和目錄。)
正準備解包 docker-ce_19.03.9_3-0_ubuntu-xenial_amd64.deb ...
正在將 docker-ce (5:19.03.9~3-0~ubuntu-xenial) 解包到 (5:19.03.9~3-0~ubuntu-xenial) 上 ...
正在設置 docker-ce (5:19.03.9~3-0~ubuntu-xenial) ...
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
正在處理用於 systemd (237-3ubuntu10.38) 的觸發器 ...
正在處理用於 ureadahead (0.100.0-21) 的觸發器 ...
複製代碼
這樣docker就安裝完畢了,是否是南孚巨簡單,萬變不離其宗的Hello-World,走你!socket
sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete
Digest: sha256:d58e752213a51785838f9eed2b7a498ffa1cb3aa7f946dda11af39286c3db9a9
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/
複製代碼
版權申明:本文章純屬原創,隨手記,若是侵權請聯繫本人刪除!ide