官网:

  • https://docs.docker.com/get-started/

  • https://hub.docker.com/

  • https://docs.docker.com/install/linux/docker-ce/ubuntu/

一、安装

1. 更新

sudo apt-get update

2. 安装依赖包

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

3. 添加官方密钥

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

4. 添加仓库

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

5. 再次更新

sudo apt-get update

6. 安装docker

sudo apt-get install -y docker-ce

二、测试

1.  查看docker服务是否启动:systemctl status docker

baoli@ubuntu:~$ systemctl status docker
● docker.service - Docker Application Container EngineLoaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)Active: active (running) since Sun 2019-09-08 15:19:27 CST; 44s agoDocs: https://docs.docker.com
Main PID: 11480 (dockerd)Tasks: 10Memory: 55.4MCPU: 893msCGroup: /system.slice/docker.service└─11480 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Sep 08 15:19:26 ubuntu dockerd[11480]: time="2019-09-08T15:19:26.795250717+08:00" level=wa
Sep 08 15:19:26 ubuntu dockerd[11480]: time="2019-09-08T15:19:26.795341137+08:00" level=wa
Sep 08 15:19:26 ubuntu dockerd[11480]: time="2019-09-08T15:19:26.795349613+08:00" level=wa
Sep 08 15:19:26 ubuntu dockerd[11480]: time="2019-09-08T15:19:26.796868238+08:00" level=in
Sep 08 15:19:27 ubuntu dockerd[11480]: time="2019-09-08T15:19:27.218386729+08:00" level=in
Sep 08 15:19:27 ubuntu dockerd[11480]: time="2019-09-08T15:19:27.438357184+08:00" level=in
Sep 08 15:19:27 ubuntu dockerd[11480]: time="2019-09-08T15:19:27.747766312+08:00" level=in
Sep 08 15:19:27 ubuntu dockerd[11480]: time="2019-09-08T15:19:27.749026100+08:00" level=in
Sep 08 15:19:27 ubuntu systemd[1]: Started Docker Application Container Engine.
Sep 08 15:19:27 ubuntu dockerd[11480]: time="2019-09-08T15:19:27.818603590+08:00" level=in
lines 1-21/21 (END)

若未启动,则启动docker: sudo systemctl start docker

2.  运行hello-world

执行:sudo docker run hello-world,提示:

baoli@ubuntu:~$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
See 'docker run --help'.

解决:

鉴于国内网络问题,后续拉取 Docker 镜像十分缓慢,我们可以需要配置加速器来解决,我使用的是网易的镜像地址:http://hub-mirror.c.163.com。

1)sudo vim  /etc/docker/daemon.json

2)添加

{
"registry-mirrors": ["http://hub-mirror.c.163.com"]
}

3)sudo service docker restart

再次执行:sudo docker run hello-world

baoli@ubuntu:~$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:451ce787d12369c5df2a32c85e5a03d52cbcef6eb3586dd03075f3034f10adcd
Status: Downloaded newer image for hello-world:latestHello 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 theexecutable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent itto 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/

Ubuntu16.04安装docker相关推荐

  1. Ubuntu16.04 安装 docker

    安装docker首先要需要一台宿主机, 我目前用VMvare下安装的Ubuntu16.04系统为宿主机,进行docker安装测试. ubuntu安装时选的中文环境,生成的sources.list里面的 ...

  2. Ubuntu16.04 安装 Docker 使用

    删除镜像: ruyulin@ruyulin-virtual-machine:~/myDocker$ sudo docker images REPOSITORY TAG IMAGE ID CREATED ...

  3. Ubuntu16.04安装Docker CE 并配置加速器

    PS:腾讯云Ubuntu16.04 64位,安装Docker CE 17.03 Docker目前分为两个版本: Docker Enterprise Edition (Docker EE) 专为企业开发 ...

  4. ubuntu16.04安装docker(阿里云镜像)

    一.查看docker安装环境要求 uname -a ls -l /sys/class/misc/device-mapper 二.安装docker # step 1: 安装必要的一些系统工具 sudo ...

  5. Ubuntu16.04通过docker安装微信和QQ

    Ubuntu16.04通过docker安装微信(wechat)和QQ(Tim) 一.安装docker sudo apt-get install docker docker images #查看是否安装 ...

  6. ubuntu16.04 安装cuda9.0+cudnn7.0.5+tensorflow+nvidia-docker配置GPU服务

    [摘要] docker很好用,但是在GPU服务器上使用docker却比较复杂,需要一些技巧,下面将介绍一下在ubuntu16.04环境下的GPU-docker环境搭建过程. 第一步: 删除之前的nvi ...

  7. ubuntu16.04安装opencv3.4.1教程

    最近opencv3.4.1发布了,想换个新的试试鲜,于是把配置的过程通过博文的方式记录下来,方便查阅.  本教程原为3.3.0,但经过博主亲测,3.4.0.3.4.1皆适用 1.去官网下载opencv ...

  8. Ubuntu16.04 安装ftp

    2019独角兽企业重金招聘Python工程师标准>>> Ubuntu16.04 安装ftp,根据依赖安装. 安装vsftpd. sudo apt-get install vsftpd ...

  9. ubuntu16.04 安装CAJViewer 以及 安装wine /deepin-wine 图标异常的解决

    ubuntu16.04 安装CAJViewer 以及 安装wine /deepin-wine 图标异常的解决 通过deepin-wine 安装 cajviewer 之前装过deepin-wine 所以 ...

最新文章

  1. synchronized 与 Reentrant均为可重入锁 区别后者比前者增加了长时等待可中断 设置是否公平锁 绑定多个条件
  2. 动态更新ViewPager?
  3. ubuntu mysql 5.7_Ubuntu 18.04 安装mysql5.7
  4. kafka版本 不对问题
  5. HDU1214 圆桌会议(找规律,数学)
  6. 如何实现 asp.net core 安全优雅退出 ?
  7. 欲善其事,先利其器 | IDCF第6期DevOps案例研究回顾(附视频)
  8. lightning接口_Lightning太赚钱?iPhone永远不会用Type-C
  9. python实现火车票查询_python实现12306火车票查询器
  10. 《零基础》MySQL GROUP BY 语句(十九)
  11. 字符串时间格式转化-java Unit
  12. cat EOF file
  13. 关于React Native init 项目时候速度太慢的解决方法
  14. gcc的ar,nm,objdump,objcopy
  15. Premiere Pro Guru: 3D Titling for Video Editors Premiere Pro 大师教程之 3D字幕条制作教程 Lynda课程中文字幕
  16. FLV格式的视频歌曲地址600首,复制地址可插入外链播放器专用
  17. Draco嵌入式AI开发板使用手册V0.1.1
  18. 《人月神话》(The Mythical Man-Month)4概念一致性:专制、民主和系统设计(System Design)...
  19. W25Q128 Flash
  20. 怎样使用jquery UI模板详解

热门文章

  1. smartfoxserver扩展里面过滤聊天的不合法字符
  2. centos下hadoop的安装
  3. 登录表单 参考新浪微博
  4. 人工大脑项目 —— Nengo
  5. [转帖]经典好文!看完后感到很震撼!
  6. linux deliver分发管理,Erlang/Elixir: 使用 Edeliver 进行自动化的持续部署
  7. 使用eclipse生成文档(javadoc)
  8. 添加javascript代码:_javascript事件?你又了解多少呢
  9. 2021宿州市地区高考成绩排名查询,2021年宿州市所有的高中排名,宿州市高中高考成绩排名出炉...
  10. linux的spio在服务器间,scp 将数据从一台linux服务器复制到另一台linux服务器