• docker 学习


    在安装之前,用户需要先确保环境已经安装好了go 语言和git

    • ubuntu 16.04 安装 docker

    修改apt-get 的软件源,调整为国内源

    sed -i "s/us./cn./g" /etc/apt/sources.list

    或者直接使用 aliyun 的apt-get 源,直接将以下内容写入到  /etc/apt/source.list 文件

    复制代码
    deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
    ##测试版源
    deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
    # 源码
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
    ##测试版源
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
    # Canonical 合作伙伴和附加
    deb http://archive.canonical.com/ubuntu/ xenial partner
    复制代码

    然后更新以下apt-get 的库列表 

    apt-get update

    安装一些基础库

    apt-get install apt-transport-https ca-certificates

    新增GPG 密钥

    apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

    增加docker 的下载源

    echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" > /etc/apt/sources.list.d/docker.list

    更新apt-get 源

    apt-get update

    查看可以安装的 docker 版本

    apt-cache policy docker-engine

    安装docker

    apt-get install docker-engine

    查看docker 版本

    docker version

    启动 docker 服务

    service docker start
    • centos 7.4 安装 docker

    首先安装libtool-ltdl 库

    yum install libtool.x86_64
    yum install libtool-ltdl-devel.x86_64

    在网上下载rpm 包,地址:https://yum.dockerproject.org/repo/main/centos/,建议下载较新的版本,作者选择了:17.05 版本,需要同时安装 docker-engine、docker-engine-selinux、libtool-ltdl 三个库,但是 libtool-ltdl 库已经通过yum 方式安装好了。

    使用 rpm 强行安装的方式安装 下载的 rpm 包

    rpm -i --nodeps docker-engine-1.12.6-1.el7.centos.x86_64.rpm ; 
    rpm -i --nodeps docker-engine-selinux-1.12.6-1.el7.centos.noarch.rpm ; 

    在shell 中检查 docker 是否安装成功

    docker version

    重启一下 docker 服务

    service docker restart
    • centos 安装 docker-compose

    由于 docker-compose 需要依赖 python-pip ,所以作者先安装一个 yum 的扩展源

    yum  install epel-release

    利用yum 安装python-pip

    yum install python-pip

    利用 pip 安装 docker-compose

    pip install docker-compose

    安装完成后,执行以下命令验证是否安装成功

    docker-compose version

    如果用户觉得这种安装方式速度慢,可以考虑采用 DaoClound 提供的 docker-compose 下载

    curl -L https://get.daocloud.io/docker/compose/releases/download/1.12.0/docker-compose-`uname -s`-`uname -m` > ~/docker-compose ;
    chmod a+x ~/docker-compose ; 
    mv ~/docker-compose /usr/bin/docker-compose
    •  ubuntu 安装 docker-compose

    由于 docker-compose 需要依赖 python-pip ,利用apt-get 安装python-pip

    apt-get install python-pip

    然后再利用 pip 安装 docker-compose,安装方式可以参考 centos 安装docker-compose

    docker 介绍:

    https://yeasy.gitbooks.io/docker_practice/content/introduction/ 

    docker-copose 的介绍:

    https://yeasy.gitbooks.io/docker_practice/content/compose/introduction.html

  • 相关阅读:
    Laravel框架之Session操作
    Laravel框架之Response操作
    Laravel之简单的学生信息管理平台
    Laravel中的模板引擎Blade
    Laravel中的查询构造器
    Laravel中使用模型对数据进行操作
    Laravel中的模型的创建
    springboot
    不丢失log的情况下迁移git空间
    Vue2.0中v-for迭代语法变化(key、index)
  • 原文地址:https://www.cnblogs.com/chenfool/p/8359517.html
Copyright © 2020-2023  润新知