• 1、Centos7系统安装docker,并配置阿里云镜像加速器


    参考docker官网安装文档以及阿里云安装文档

      docker官网安装文档地址:https://docs.docker.com/install/linux/docker-ce/centos/

      阿里云docker安装文档地址:https://yq.aliyun.com/articles/110806?spm=5176.8351553.0.0.66041991AtwfFJ

     注意我这种安装是要在联网的情况下!!!

    1、卸载旧版本docker(如果没有安装过自然不用卸载,跳过这一步)

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

    2、安装必要的一些系统工具

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

    3、添加软件源信息(这里使用国内的阿里云,docker官网上国外地址网速太慢)

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

    4、更新并安装 Docker-CE(社区版,如果是企业安装也可以选择企业版,参考官网文档:https://docs.docker.com/install/linux/docker-ee/centos/

    sudo yum makecache fast
    sudo yum install docker-ce docker-ce-cli containerd.io

    5、开启Docker服务

    sudo systemctl start docker   //centos7开启服务是systemctl,centos6是service

    6、检查docker版本

    复制代码
    docker version

    //执行上面命令,出现下面结果

    [root@localhost ~]# docker version
    Client: Docker Engine - Community
    Version: 19.03.4
    API version: 1.40
    Go version: go1.12.10
    Git commit: 9013bf583a
    Built: Fri Oct 18 15:52:22 2019
    OS/Arch: linux/amd64
    Experimental: false

    Server: Docker Engine - Community
    Engine:
    Version: 19.03.4
    API version: 1.40 (minimum version 1.12)
    Go version: go1.12.10
    Git commit: 9013bf583a
    Built: Fri Oct 18 15:50:54 2019
    OS/Arch: linux/amd64
    Experimental: false
    containerd:
    Version: 1.2.10
    GitCommit: b34a5c8af56e510852c35414db4c1f4fa6172339
    runc:
    Version: 1.0.0-rc8+dev
    GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
    docker-init:
    Version: 0.18.0
    GitCommit: fec3683

    复制代码

    7、运行docker测试项目

    复制代码
    sudo docker run hello-world
    //运行上面命令,得到下面结果
    [root@localhost ~]# sudo docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 1b930d010525: Pull complete Digest: sha256:c3b4ada4687bbaa170745b3e4dd8ac3f194ca95b2d0518b417fb47e5879d9b5f Status: Downloaded newer image for hello-world:latest Hello from Docker! //////////出现这句说明测试镜像运行成功 This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
    复制代码

    重点来啦!!!!      

    重点来啦!!!!       

    重点来啦!!!!

    8、配置阿里云镜像加速器

    (1)打开链接:https://cr.console.aliyun.com

    (2)注册账号,或者使用支付宝账号登陆

    (3)登陆后进入下面页面(如果是centos记得点centos这一列的

     (4)选择<镜像加速器>菜单,右边会显示你专属的镜像加速器地址,然后选择centos,直接复制上图红框中的代码在终端中运行即可,或者复制下面命令,修改为自己的镜像加速地址后运行

    复制代码
    sudo mkdir -p /etc/docker
    sudo tee /etc/docker/daemon.json <<-'EOF'
    {
      "registry-mirrors": ["写改为自己的镜像加速地址"]
    }
    EOF
    sudo systemctl daemon-reload
    sudo systemctl restart docker
    复制代码

    到此centos7系统下安装docker已经完成!!!

  • 相关阅读:
    Log4Net详解(2)结构篇
    vs2012中使用Spring.NET报错:Spring.Context.Support.ContextRegistry 的类型初始值设定项引发异常
    vs2010无法打开项目文件的解决方法
    Spring.NET使用assembly方式设置配置文件
    WebService生成XML文档时出错。不应是类型XXXX。使用XmlInclude或SoapInclude属性静态指定非已知的类型。
    [转贴]如何做好一个垂直搜索引擎
    怎样预防RSI呢?
    推荐一个打折的站点
    五子棋程序
    共享两本C++的好书
  • 原文地址:https://www.cnblogs.com/lyh233/p/12563537.html
Copyright © 2020-2023  润新知