zoukankan      html  css  js  c++  java
  • Centos7 安装docker ce

    一. 安装docker

    1.升级rpm包

    yum -y update  

    2. 通过命令设置Docker CE 资源库: 

     yum install -y yum-utils      
     yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo  

    3.生成缓存

    sudo yum makecache fast 

    4.查看可下载版本

    yum list docker-ce --showduplicates | sort -r

    4.安装并启动docker

    yum -y install docker-ce  

    二.设置镜像下载地址

    在/etc/docker/daemon.json 内添加

     {
          "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]
        }
        

    三、开放管理端口映射

    1.编辑  /lib/systemd/system/docker.service

      ExecStart=/usr/bin/dockerd 

      替换为 下面


    ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock

    2.将管理地址变量写进profile

    echo 'export DOCKER_HOST=tcp://0.0.0.0:2375' >> /etc/profile

    四.重启服务

    systemctl daemon-reload && systemctl  restart docker

    五、测试docker

    docker run hello-world 

    若成功:

    Unable to find image 'hello-world:latest' locally
    latest: Pulling from library/hello-world
    Digest: sha256:f5233545e43561214ca4891fd1157e1c3c563316ed8e237750d59bde73361e77
    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/engine/userguide/
  • 相关阅读:
    [luogu4053 JSOI2007] 建筑抢修 (贪心 优先队列)
    [luogu2272 ZJOI2007] 最大半连通子图 (tarjan缩点 拓扑排序 dp)
    20180705 考试记录
    [luogu4310] 绝世好题 (递推)
    [luogu2765 网络流24题] 魔术球问题 (dinic最大流)
    [luogu4151 WC2011] 最大XOR和路径 (线性基)
    [luogu3232 HNOI2013] 游走 (高斯消元 期望)
    [luogu3726 HNOI2017] 抛硬币 (拓展lucas)
    20180703 考试记录
    [spoj] HIGH
  • 原文地址:https://www.cnblogs.com/benjamin77/p/9082350.html
Copyright © 2011-2022 走看看