Ubuntu Docker 安装

Docker 教程 · 2019-02-18 07:44:25

Docker 支持以下的 Ubuntu 版本:

  • Ubuntu Precise 12.04 (LTS)
  • Ubuntu Trusty 14.04 (LTS)
  • Ubuntu Wily 15.10
  • 其他更新的版本……

前提条件

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

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

codercto@codercto:~$ uname -r

使用脚本安装 Docker

1、获取最新版本的 Docker 安装包

codercto@codercto:~$ wget -qO- https://get.docker.com/ | sh

输入当前用户的密码后,就会下载脚本并且安装Docker及依赖包。

安装完成后有个提示:

    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 codercto
   Remember that you will have to log out and back in for this to take effect!  

当要以非root用户可以直接运行docker时,需要执行 sudo usermod -aG docker codercto 命令,然后重新登陆,否则会有如下报错

2、启动docker 后台服务

codercto@codercto:~$ sudo service docker start

3、测试运行hello-world

codercto@codercto:~$ docker run hello-world

镜像加速

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

新版的 Docker 使用 /etc/docker/daemon.json(Linux) 或者 %programdata%\docker\config\daemon.json(Windows) 来配置 Daemon。

请在该配置文件中加入(没有该文件的话,请先建一个):

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

在 Cloud Studio 中运行 Docker

下面我们介绍如何在 Cloud Studio 中安装、使用 Docker:

  • step1:访问 腾讯云开发者平台,注册/登录账户。

  • step2:在右侧的运行环境码单选择:"ubuntu"

  • step3:在下方的终端执行命令,获取最新版本的 Docker 安装包并执行安装:

    wget -qO- https://get.docker.com/ | sh
  • step4:启动 docker 后台服务:

    sudo service docker start
  • step5:测试运行 hello-world:

    sudo docker run hello-world

现在 CODING 正在举办一场基于 Cloud Studio 工作空间的【我最喜爱的 Cloud Studio 插件评选大赛】。进入活动官网:https://studio.qcloud.coding.net/campaign/favorite-plugins/index,了解更多活动信息。

点击查看所有 Docker 教程 文章: https://www.codercto.com/courses/l/15.html

查看所有标签

图解密码技术

图解密码技术

[日] 结城浩 / 周自恒 / 人民邮电出版社 / 2014-12 / 79.00元

本书以图配文的形式,详细讲解了6种最重要的密码技术:对称密码、公钥密码、单向散列函数、消息认证码、数字签名和伪随机数生成器。 第一部分讲述了密码技术的历史沿革、对称密码、分组密码模式(包括ECB、CBC、CFB、OFB、CTR)、公钥、混合密码系统。第二部分重点介绍了认证方面的内容,涉及单向散列函数、消息认证码、数字签名、证书等。第三部分讲述了密钥、随机数、PGP、SSL/TLS 以及密码技......一起来看看 《图解密码技术》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具