zoukankan      html  css  js  c++  java
  • CentOS && Ubuntu 环境下 Docker 的安装配置

    CentOS 7 install Docker

    Docker 支持的 centos 版本:CentOS 6.5(64-bit)或更高的版本

    使用 yum 安装

    1)确保 yum 包更新到最新

    [root@centos7 ~]# yum update

    2)Docker 软件包和依赖包已经包含在默认的 CentOS-Extras 软件源里,安装命令如下

    [root@centos7 ~]# yum -y install docker-ce

    3)安装完成Docker后,默认已经启动了docker服务,如需手动控制docker服务的启停,可执行如下命令

    启动docker 
    systemctl start docker.service
    
    停止docker 
    systemctl stop docker.service
    
    重启docker
    systemctl restart docker.service
    
    检查运行状态
    systemctl status docker.service

    4)验证是否安装成功

    [root@centos7 ~]# docker version

    5)测试运行 hello-world

    [root@centos7 ~]# docker run hello-world

    执行效果:

    6)添加开机启动

    [root@centos7 ~]# systemctl enable docker

    Ubuntu install Docker

    1)更新 ubuntu 的 apt 源索引

    sudo apt-get update

    2)安装包允许apt通过HTTPS使用仓库

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

    3)添加Docker官方GPG key

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

    4)设置Docker稳定版仓库

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

    5)添加仓库后,更新apt源索引

    sudo apt-get update

    6)安装最新版Docker CE(社区版)

    sudo apt-get install docker-ce

    7)检查Docker CE是否安装正确

    sudo docker run hello-world

    出现如下信息,表示安装成功

    8)为了避免每次命令都输入sudo,可以设置用户权限,注意执行后须注销重新登录

    sudo usermod -a -G docker $USER

    9)启动与停止

    安装完成Docker后,默认已经启动了docker服务,如需手动控制docker服务的启停,可执行如下命令

    # 启动docker
    sudo service docker start
    
    # 停止docker
    sudo service docker stop
    
    # 重启docker
    sudo service docker restart
    
    # 检查运行状态
    sudo service docker status

     ending ~

    每天都要遇到更好的自己.
  • 相关阅读:
    STL源码剖析 真是一本好书
    消息映射与消息路由原理
    linux下无法正常打开pdf文件的解决方法
    [转载]Amazon's Dynamo 中文版
    [转载]NoSQL数据建模技术
    [转载]linuxkerneltuningfor500k
    YCSB初步介绍
    Lamport's Logical Clocks 和 Vector Clock
    googleperftools 试用
    [转载]Big List Of 20 Common Bottlenecks
  • 原文地址:https://www.cnblogs.com/kaichenkai/p/11314322.html
Copyright © 2011-2022 走看看