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 ~

    每天都要遇到更好的自己.
  • 相关阅读:
    设置VSS2005使支持通过Internet访问
    Twisted网络编程必备(3)
    Python中re(正则表达式)模块学习
    Python中最快的字典排序方法
    理解Python命名机制
    Twisted网络编程必备(2)
    threading 多线程控制和处理
    Twisted网络编程必备(5)
    Python中动态创建类实例
    判断是否为字符串
  • 原文地址:https://www.cnblogs.com/kaichenkai/p/11314322.html
Copyright © 2011-2022 走看看