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