centos7使用docker1.8.2

来源:互联网 发布:java实现短信发送代码 编辑:程序博客网 时间:2024/06/06 04:28
  1. yum install docker-io或curl -sSL https://get.daocloud.io/docker | sh
  2. service docker start

    如果出现[root@localhost 桌面]# service docker startStarting docker (via systemctl):  Job for docker.service failed. See 'systemctl status docker.service' and 'journalctl -xn' for details. [失败]则有可能是防火墙开启的原因,可先关闭防火墙:service firewalld stop
  3. docker run hello-world

    出现错误“Cannot connect to the Docker daemon. Is 'docker -d' running on this host?”网上找到解决方式:http://blog.csdn.net/xu470438000/article/details/43704469执行:yum upgrade device-mapper-libs
  4. 再次执行:docker run hello-world

         INFO[0211] POST /v1.19/containers/create                ERRO[0211] Handler for POST /containers/create returned error: No such image: hello-world (tag: latest) ERRO[0211] HTTP Error                                    err=No such image: hello-world (tag: latest) statusCode=404Unable to find image 'hello-world:latest' locallyINFO[0211] POST /v1.19/images/create?fromImage=hello-world&tag=latest Pulling repository hello-worldaf340544ed62: Download complete 535020c3e8ad: Download complete Status: Downloaded newer image for hello-world:latestINFO[0258] POST /v1.19/containers/create                INFO[0258] POST /v1.19/containers/7402e7645ff9349d309b2190fba0896e5b7e233c29532e64f45ddde2f60fe1e8/attach?stderr=1&stdout=1&stream=1 INFO[0258] POST /v1.19/containers/7402e7645ff9349d309b2190fba0896e5b7e233c29532e64f45ddde2f60fe1e8/start 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. 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 bashShare images, automate workflows, and more with a free Docker Hub account: https://hub.docker.comFor more examples and ideas, visit: https://docs.docker.com/userguide/INFO[0258] POST /v1.19/containers/7402e7645ff9349d309b2190fba0896e5b7e233c29532e64f45ddde2f60fe1e8/wait 
  5. docker加速器
    国内可使用daocloud提供的加速器,先安装:

    curl -sSL https://get.daocloud.io/daomonit/install.sh | sh -s 8d8c58ec216430cfd29537464890238105ef5bc9

    可以通过运行dpkg -r daomonit 卸载主机监控程序。(Centos通过rpm -e daomonit卸载,Docker ToobBox通过docker rm -f daomonit卸载)

    只需要在拉取镜像时使用 dao pull 命令即可:

    dao pull ubuntu
0 0
原创粉丝点击