参考自

https://yeasy.gitbooks.io/docker_practice/install/ubuntu.html#ubuntu-1604-

docker-io 是以前早期的版本,版本号是 1.*,最新版是 1.13,而 docker-ce 是新的版本,分为社区版 docker-ce 和企业版 docker-ee

准备工作

系统要求

Docker CE 支持以下版本的 Ubuntu 操作系统:

Bionic 18.04 (LTS)
Xenial 16.04 (LTS)
Trusty 14.04 (LTS) (Docker CE v18. 及以下版本)

Docker CE 可以安装在 64 位的 x86 平台或 ARM 平台上。Ubuntu 发行版中,LTS(Long-Term-Support)长期支持版本,会获得 5 年的升级维护支持,这样的版本会更稳定,因此在生产环境中推荐使用 LTS 版本。

卸载旧版本

旧版本的 Docker 称为 docker 或者 docker-engine,使用以下命令卸载旧版本:

 sudo apt-get remove docker  docker-engine  docker.io

Ubuntu 16.04 +

Ubuntu 16.04 + 上的 Docker CE 默认使用 overlay2 存储层驱动,无需手动配置。

使用 APT 安装

由于 apt 源使用 HTTPS 以确保软件下载过程中不被篡改。

sudo apt-get update

添加使用 HTTPS 传输的软件包以及 CA 证书。

sudo apt-get install  apt-transport-https  ca-certificates curl software-properties-common

鉴于国内网络问题,强烈建议使用国内源,官方源请在注释中查看。

为了确认所下载软件包的合法性,需要添加软件源的 GPG 密钥。

curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

# 官方源
# $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

然后,我们需要向 source.list 中添加 Docker 软件源

$ sudo add-apt-repository \
"deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \
$(lsb_release -cs) \
stable" # 官方源
# $ sudo add-apt-repository \
# "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
# $(lsb_release -cs) \
# stable"

以上命令会添加稳定版本的 Docker CE APT 镜像源,如果需要测试或每日构建版本的 Docker CE 请将 stable 改为 test 或者 nightly。

安装 Docker CE

更新 apt 软件包缓存,并安装 docker-ce

$ sudo apt-get update

$ sudo apt-get install docker-ce

启动 Docker CE

$ sudo systemctl enable docker
$ sudo systemctl start docker

建立 docker 用户组

默认情况下,docker 命令会使用 Unix socket 与 Docker 引擎通讯。而只有 root 用户和 docker 组的用户才可以访问 Docker 引擎的 Unix socket。出于安全考虑,一般 Linux 系统上不会直接使用 root 用户。因此,更好地做法是将需要使用 docker 的用户加入 docker 用户组。

建立 docker 组:

$ sudo groupadd docker

将当前用户加入 docker 组:

$ sudo usermod -aG docker $USER

退出当前终端并重新登录,进行如下测试。

sudo service docker restart

测试 Docker 是否安装正确

docker run hello-world

提示..... unix /var/run/docker.sock权限不够

则修改/var/run/docker.sock权限

sudo chmod a+rw /var/run/docker.sock
docker run hello-world

等待一会

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
d1725b59e92d: Pull complete
Digest: sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9fde470971e499788
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:
. The Docker client contacted the Docker daemon.
. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
. 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/

若能正常输出以上信息,则说明安装成功

Ubuntu 安装 Docker CE(社区版)的更多相关文章

  1. centos 7 安装 Docker Engine-CentOS 社区版

    获取Docker Engine-CentOS社区: https://docs.docker.com/install/linux/docker-ce/centos/ 1.操作系统要求 1.1 要安装 D ...

  2. Ubuntu 安装 Docker CE

    注:本文转载自<Docker入门> 警告:切勿在没有配置 Docker APT 源的情况下直接使用 apt 命令安装 Docker. 准备工作 系统要求 Docker CE 支持以下版本的 ...

  3. Ubuntu安装 Docker CE,VNC访问docker图形界面并安装ROS

    从包安装 如果您无法使用Docker的存储库来安装Docker CE,则可以下载.deb适用于您的发行版的 文件并手动安装.每次要升级Docker CE时都需要下载新文件. 安装Docker CE,将 ...

  4. Ubuntu 安装docker CE以及harbor

    Docker CE安装 系统建议版本:Ubuntu 16.04 官方安装文档连接:https://docs.docker.com/install/linux/docker-ce/ubuntu/#pre ...

  5. 详细介绍Ubuntu 16.04系统环境安装Docker CE容器的过程

    由于项目的需要,我们在很多软件配置环境中需要用到Docker容器,这个时候我们可以用自己的VPS主机搭建.在这篇文章中,笔者将会利用Ubuntu 16.04系统环境安装Docker CE容器的过程.如 ...

  6. Ubuntu安装docker笔记

    前言   根据参考文档简单记录Ubuntu系统安装docker的步骤 系统版本 panzi@ubuntu:~$ cat /etc/issue Ubuntu 16.04.5 LTS \n \l 移除旧版 ...

  7. docker -ce(社区免费版)

    Docker -ce https://www.cnblogs.com/zhangxiaoyong/p/9706392.html Docker 是世界领先的软件容器平台.开发人员利用 Docker 可以 ...

  8. 记录Ubuntu 16.04 安装Docker CE

    一.Docker的两个版本 Docker有两个版本: 社区版(CE) 企业版(EE) Docker Community Edition(CE)非常适合希望开始使用Docker并尝试使用基于容器的应用程 ...

  9. [笔记] Ubuntu 18.04安装Docker CE及nvidia-docker2流程

    Docker的好处之一,就是在Container里面可以随意瞎搞,不用担心弄崩Host的环境. 而nvidia-docker2的好处是NVidia帮你配好了Host和Container之间的CUDA相 ...

随机推荐

  1. Chapter 5 Blood Type——17

    "I'll be coming around with a dropper of water to prepare your cards, so please don't start unt ...

  2. mysql锁机制详解

    前言 大概几个月之前项目中用到事务,需要保证数据的强一致性,期间也用到了mysql的锁,但当时对mysql的锁机制只是管中窥豹,所以本文打算总结一下mysql的锁机制. 本文主要论述关于mysql锁机 ...

  3. python 中 *args 和 **kwargs 的区别

    在 python 中,*args 和 **kwargs 都代表 1个 或 多个 参数的意思.*args 传入tuple 类型的无名参数,而 **kwargs 传入的参数是 dict 类型.下文举例说明 ...

  4. 痞子衡嵌入式:串口调试工具Jays-PyCOM诞生记(1)- 环境搭建(Python2.7.14 + pySerial3.4 + wxPython4.0.3)

    大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是串口调试工具Jays-PyCOM诞生之环境搭建. 在写Jays-PyCOM时需要先搭好开发和调试环境,下表列出了开发过程中会用到的所有软 ...

  5. Python并发编程之消息队列补充及如何创建线程池(六)

    大家好,并发编程 进入第六篇. 在第四章,讲消息通信时,我们学到了Queue消息队列的一些基本使用.昨天我在准备如何创建线程池这一章节的时候,发现对Queue消息队列的讲解有一些遗漏的知识点,而这些知 ...

  6. IDEA写scala简单操作

    今天尝试了一下在IntelliJ IDEA里面写Scala代码,并且做到和Java代码相互调用,折腾了一下把过程记录下来. 首先需要给IntelliJ IDEA安装一下Scala的插件,在IDEA的启 ...

  7. [Go] golang缓冲通道实现资源池

    go的pool资源池:1.当有多个并发请求的时候,比如需要查询数据库2.先创建一个2个容量的数据库连接资源池3.当一个请求过来的时候,去资源池里请求连接资源,肯定是空的就创建一个连接,执行查询,结束后 ...

  8. 学JAVA第四天,JAVA获取年月日

    先添加引用import java.util.Calendar; 然后编写代码: Calendar calendar = null;//声明 calendar= Calendar.getInstance ...

  9. Canvas:时钟

    这个时钟是将钟盘的圆心点移到了 canvas 画布中心点.以方便后面的方位计算 ctx.translate(width/2,height/2); 现定义一个圆盘来显出这个时钟的基本位置 ctx.sav ...

  10. #WEB安全基础 : HTML/CSS | 0x6嵌套标签(图片链接)

    嵌套标签我们已经讲一次了,在0X4.1里,我们把列表嵌套了 你觉得文字链接难看得令人作呕,好,你再也不会有这种感觉了   一如既往,一个html文件和一个存放图片的文件夹 index.html的代码, ...