• Docker容器(二):Docker安装


    仅仅介绍CentOS上的使用,Ubuntu等不会 _,Docker官方文档指出,它必须运行在CentOS6.8及以上的系统中,6.8和7的安装几乎一样,仅有几个命令不太相同,后续仅使用7+版本。

    Docker有关网站

    1. 英文官网:httpss://www.docker.com/
    2. 中文官网:https://docker-cn.com/
    3. 英文镜像仓库:httpss://hub.docker.com/
    4. 阿里云镜像仓库:httpss://dev.aliyun.com/
    5. 英文文档:httpss://docs.docker.com/

    Docker安装

    查看Linux版本

    cat /etc/redhat-release 或者 lsb_release -a
    

    安装

    安装gcc

    1. yum -y install gcc
    2. yum -y install gcc-c++

    卸载旧的

    如果以前没有安装过,可以省去这一步。

    $ sudo yum remove docker 
                      docker-client 
                      docker-client-latest 
                      docker-common 
                      docker-latest 
                      docker-latest-logrotate 
                      docker-logrotate 
                      docker-selinux 
                      docker-engine-selinux 
                      docker-engine
    

    安装软件包

    yum-utils提供了yum-config-manager 效用,并device-mapper-persistent-data和lvm2由需要 devicemapper存储驱动程序。

    yum install -y yum-utils device-mapper-persistent-data lvm2

    设置stable仓库

    使用以下命令设置稳定存储库。

    yum-config-manager --add-repo httpss://download.docker.com/linux/centos/docker-ce.repo

    上面的下载连接是国外的网址,但你懂的,由于伟大的wall,推荐使用阿里云的。

    yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

    更新yum索引

    yum makecache fast

    为的是下载速度快点。

    安装Docker CE

    yum -y install docker-ce

    6.8版本是docker-io,7以上的版本是docker-ce

    启动

    systemctl start docker

    测试

    docker run hello-world

    会打印出Hello from Docker!。。。。等好多,代表成功。

    镜像加速

    阿里云和网易云加速都可以,但都需要自己注册一个账号,这里配置阿里云加速。
    daemon文件内容,其中的网址是注册后由阿里提供个人加速地址:

    {
    	"registry-mirrors": ["httpss://juogu5zd.mirror.aliyuncs.com"]
    }
    
    mkdir -p /etc/docker
    vim /etc/docker/daemon.json
    systemctl daemon-reload
    systemctl restart docker
    

    卸载

    yum remove docker-ce
    rm -rf /var/lib/docker
    
  • 相关阅读:
    Leetcode: Summary Ranges
    Leetcode: Kth Smallest Element in a BST
    Leetcode: Basic Calculator II
    Leetcode: Basic Calculator
    Leetcode: Count Complete Tree Nodes
    Leetcode: Implement Stack using Queues
    Leetcode: Maximal Square
    Leetcode: Contains Duplicate III
    Leetcode: Invert Binary Tree
    Leetcode: The Skyline Problem
  • 原文地址:https://www.cnblogs.com/zhangjianbing/p/12443296.html
Copyright © 2020-2023  润新知