前提条件

Docker 要求 Ubuntu 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的 Ubuntu 版本是否支持 Docker。

通过 uname -r 命令查看你当前的内核版本

root@ranxf:/home/ranxf# uname -r
4.13.0-38-generic

使用脚本安装Docker

root@ranxf:/home/ranxf# wget -qO- https://get.docker.com/ | sh

下载脚本并且安装Docker及依赖包

root@ranxf:/home/ranxf# wget -qO- https://get.docker.com/ | sh
# Executing docker install script, commit: 92d5116
+ sh -c apt-get update -qq >/dev/null
+ sh -c apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
+ sh -c curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | apt-key add -qq - >/dev/null
+ sh -c echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial edge" > /etc/apt/sources.list.d/docker.list
+ [ ubuntu = debian ]
+ sh -c apt-get update -qq >/dev/null
+ sh -c apt-get install -y -qq --no-install-recommends docker-ce >/dev/null
+ sh -c docker version
Client:
Version: 18.04.0-ce
API version: 1.37
Go version: go1.9.4
Git commit: 3d479c0
Built: Tue Apr 10 18:20:32 2018
OS/Arch: linux/amd64
Experimental: false
Orchestrator: swarm Server:
Engine:
Version: 18.04.0-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.4
Git commit: 3d479c0
Built: Tue Apr 10 18:18:40 2018
OS/Arch: linux/amd64
Experimental: false
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like: sudo usermod -aG docker your-user Remember that you will have to log out and back in for this to take effect!

安装完成后有个提示:当要以非root用户可以直接运行docker时,需要执行 sudo usermod -aG docker runoob 命令,然后重新登陆

WARNING: Adding a user to the "docker" group will grant the ability to run
containers which can be used to obtain root privileges on the
docker host.
Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
for more information.

2、启动docker 后台服务

root@ranxf:/home/ranxf# service docker start
root@ranxf:/home/ranxf#
root@ranxf:/home/ranxf# ps -ef |grep docker
root 474 1 0 14:28 ? 00:00:01 /usr/bin/dockerd -H fd://
root 481 474 0 14:28 ? 00:00:01 docker-containerd --config /var/run/docker/containerd/containerd.toml
root 2103 18769 0 14:41 pts/12 00:00:00 grep --color=auto docker
root@ranxf:/home/ranxf#

3、测试运行hello-world

root@ranxf:/home/ranxf# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
9bb5a5d4561a: Pull complete
Digest: sha256:f5233545e43561214ca4891fd1157e1c3c563316ed8e237750d59bde73361e77
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/engine/userguide/

你可能想核对一下 docker 版本:

root@ranxf:/home/ranxf# docker version
Client:
Version: 18.04.0-ce
API version: 1.37
Go version: go1.9.4
Git commit: 3d479c0
Built: Tue Apr 10 18:20:32 2018
OS/Arch: linux/amd64
Experimental: false
Orchestrator: swarm Server:
Engine:
Version: 18.04.0-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.4
Git commit: 3d479c0
Built: Tue Apr 10 18:18:40 2018
OS/Arch: linux/amd64
Experimental: false

现在,docker 已经安装在您的系统上。

镜像加速:

如果要配置 Docker 守护进程默认使用 Docker 官方镜像加速。可以在 Docker 守护进程启动时配置 --registry-mirror 参数。

通过命令行启动Docker

docker --registry-mirror=https://registry.docker-cn.com daemon

通过配置文件启动Docker

Docker 版本在 1.12 或更高

修改 /etc/docker/daemon.json 文件并添加上 registry-mirrors 键值(没有该文件的话,请先建一个)。

鉴于国内网络问题,后续拉取 Docker 镜像十分缓慢,我们可以需要配置加速器来解决,如:网易的镜像地址

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

从 Docker 库先下载 Docker Image 制作的容器。

root@ranxf:/home/ranxf# docker run ubuntu:15.10 /bin/echo "Hello world"
Unable to find image 'ubuntu:15.10' locally
15.10: Pulling from library/ubuntu
7dcf5a444392: Downloading [====================================> ] 37.63MB/51.07MB
759aa75f3cee: Download complete
7dcf5a444392: Pull complete
759aa75f3cee: Pull complete
3fa871dc8a2b: Pull complete
224c42ae46e7: Pull complete
Digest: sha256:02521a2d079595241c6793b2044f02eecf294034f31d6e235ac4b2b54ffc41f3
Status: Downloaded newer image for ubuntu:15.10

Ubuntu16.04 Docker 安装的更多相关文章

  1. ubuntu16.04 docker安装

    docker官网安装页面:https://docs.docker.com/engine/installation/linux/ubuntu/ 这个是ubuntu14.04 LTS需要的 $ sudo ...

  2. docker学习笔记(一)—— ubuntu16.04下安装docker

    docker学习笔记(一)—— ubuntu16.04下安装docker 原创 2018年03月01日 14:53:00 标签: docker / ubuntu 1682 本文开发环境为Ubuntu ...

  3. Ubuntu16.04编译安装php

    #Ubuntu16.04编译安装php Ubuntu16.04上面搭建基于Nginx的php服务.Nginx使用apt直接安装的. sudo apt install nginx php的安装部署步骤主 ...

  4. Ubuntu16.04下安装数据库oracle客户端

    在Ubuntu16.04下安装oracle数据库客户端,使Django项目连接到远程Oracle数据库. 1.下载oracle客户端安装包: 进入官网http://www.oracle.com/tec ...

  5. Ubuntu16.04下安装redis

    Ubuntu16.04下安装redis 保证网络畅通,选定好下载工作路径,执行以下命令下载redis-3.2.6: sudo wget http://download.redis.io/release ...

  6. ubuntu16.04 python3 安装selenium及环境配置

    环境 ubuntu16.04 python3 安装selenium sudo pip3 install seleium 默认安装完是支持firefox,但是更新得太慢对于较新的firefox已经不支持 ...

  7. Ubuntu16.04下安装Hadoop

    一.记录理由 刚开始只是想要学习怎么使用Hive的.想着安装应该很简单,没想到花了整整一天的时间来安装,为了避免下次犯同样的错误,特此记录. 二.安装Hadoop 网上教你怎么安装Hadoop的文章有 ...

  8. SLAM+语音机器人DIY系列:(二)ROS入门——3.在ubuntu16.04中安装ROS kinetic

    摘要 ROS机器人操作系统在机器人应用领域很流行,依托代码开源和模块间协作等特性,给机器人开发者带来了很大的方便.我们的机器人“miiboo”中的大部分程序也采用ROS进行开发,所以本文就重点对ROS ...

  9. 通过Anaconda在Ubuntu16.04上安装 TensorFlow(GPU版本)

    一. 安装环境 Ubuntu16.04.3 LST GPU: GeForce GTX1070 Python: 3.5 CUDA Toolkit 8.0 GA1 (Sept 2016) cuDNN v6 ...

随机推荐

  1. 码农深耕 - 说说IDisposable

    概要 C#提供了方便的垃圾回收机制,使我们几乎不再需要为资源管理费心.可事实上,能被垃圾回收释放掉的只是托管资源,非托管资源还是需要我们手动释放.而为了实现这一目的,C#提供了 IDisposable ...

  2. Servlet与JSP九大内置对象的对应关系

    JSP对象 Servlet中怎样获得 out resp.getWriter request service方法中的req参数 response service方法中的resp参数 session re ...

  3. 【BZOJ3572】[Hnoi2014]世界树 虚树

    [BZOJ3572][Hnoi2014]世界树 Description 世界树是一棵无比巨大的树,它伸出的枝干构成了整个世界.在这里,生存着各种各样的种族和生灵,他们共同信奉着绝对公正公平的女神艾莉森 ...

  4. 《从零开始学Swift》学习笔记(Day67)——Cocoa Touch设计模式及应用之MVC模式

    原创文章,欢迎转载.转载请注明:关东升的博客 MVC(Model-View-Controller,模型-视图-控制器)模式是相当古老的设计模式之一,它最早出现在Smalltalk语言中.现在,很多计算 ...

  5. js访问CSS最终计算样式

    所谓计算样式,就是嵌入式样式.外部样式表.内联样式综合的样式表现,那么如何来获取呢? "DOM2 级样式"增强了document.defaultView,提供了getCompute ...

  6. angular中的动画效果

    用angular来形成动画效果的代码如下 <!DOCTYPE html> <html lang="en" ng-app="app"> & ...

  7. w[wi].disabled = true;

    w 目的:订房页面,已被预订的房间的时间段的区域td点击不弹出bootstrap模态框. <script> var w = document.querySelectorAll(" ...

  8. WSGI的理解 perfect

    https://blog.csdn.net/hzrandd/article/details/10099871 https://blog.csdn.net/cloudxli/article/detail ...

  9. requests设置Authorization

    headers = {"Authorization", "Bearer {}".format(token_string)} r = requests.get(& ...

  10. hibernate 单向 n-n

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/qilixiang012/article/details/27956057 域模型: 关系数据模型 n ...