• 第 1 章 容器生态系统


    搭建实验环境

    • 管理工具 - Docker Engine
    • runtime - runc
    • 操作系统 - Ubuntu

    安装 Docker

    0、更新 apt 源

     1     /etc/apt/sources.list
     2     # deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
     3     deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
     4     deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
     5     deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
     6     deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
     7     deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
     8     deb http://mirrors.aliyun.com/ubuntu/ xenial universe
     9     deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
    10     deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
    11     deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
    12     deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
    13     deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
    14     deb http://archive.canonical.com/ubuntu xenial partner
    15     deb-src http://archive.canonical.com/ubuntu xenial partner
    16     deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
    17     deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
    18     deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
    19     deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

    1、配置安装Docker的apt源

    a) 安装包,允许 apt 命令 HTTPS 访问 Docker 源。

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

    b) 添加 Docker 官方的 GPG

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

    c)将 Docker 的源添加到 /etc/apt/sources.list

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

     

    2、安装 Docker

    1 sudo apt-get update
    2 sudo apt-get install docker-ce

     运行第一个容器

    环境就绪,马上运行第一个容器,执行命令:

    1 docker run -d -p 80:80 httpd

    启动 httpd 容器,并将容器的 80 端口映射到 host 的 80 端口。

    本地测试

    1 curl http://127.0.0.1:80

     

    其过程为:

    • 从 Docker Hub 下载 httpd 镜像。镜像中已经安装好了 Apache HTTP Server。
    • 启动 httpd 容器,并将容器的 80 端口映射到 host 的 80 端口。

    3、Docker下载加速器

    由于 Docker Hub 的服务器在国外,下载镜像会比较慢。DaoCloud 为我们提供了免费的国内镜像服务。

    • 在 daocloud.io 免费注册一个用户。
    • 登录后,点击顶部菜单“加速器”。
    • copy “加速器”命令并在 host 中执行。
    curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://53dc37d0.m.daocloud.io
    •  重启 Docker deamon,即可体验飞一般的感觉。
     systemctl restart docker.service

    脚本安装docker

     1 #!/bin/bash
     2 cp /etc/apt/sources.list /etc/apt/sources.list.bak
     3 echo '
     4 # deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
     5 deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
     6 deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
     7 deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
     8 deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
     9 deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
    10 deb http://mirrors.aliyun.com/ubuntu/ xenial universe
    11 deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
    12 deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
    13 deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
    14 deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
    15 deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
    16 deb http://archive.canonical.com/ubuntu xenial partner
    17 deb-src http://archive.canonical.com/ubuntu xenial partner
    18 deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
    19 deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
    20 deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
    21 deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
    22 ' > /etc/apt/sources.list
    23 
    24 sudo apt-get update
    25 apt-get install -y apt-transport-https ca-certificates curl software-properties-common
    26 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    27 sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu  $(lsb_release -cs)  stable"
    28 sudo apt-get update
    29 sudo apt-get install -y docker-ce
    30 curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://53dc37d0.m.daocloud.io
    31 systemctl restart docker.service

    ---------------------引用来自--------------------------

    https://mp.weixin.qq.com/s?__biz=MzIwMTM5MjUwMg==&mid=2653587561&idx=1&sn=b0cb2a5a25fb7de843f0e5e774954063&chksm=8d308070ba4709667ee40a464eb30df42a13187dada3fb8db6b33a0a69f3ccc4f382e01305e4&scene=21#wechat_redirect

     

  • 相关阅读:
    对于delphi 三层的理解
    XE6调用android标准功能
    修复 XE7 Frame 内 PopupMenu 快捷键失效问题 by 龟山阿卍
    最大熵模型 二
    最大熵模型
    算法复习-平面内极大值点
    算法复习-生成全排列
    算法复习-归并排序
    算法复习-快速排序
    连续特征的离散化
  • 原文地址:https://www.cnblogs.com/gsophy/p/10141266.html
Copyright © 2020-2023  润新知