centos7安装docker

Posted jackyzm

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7安装docker相关的知识,希望对你有一定的参考价值。

一:环境准备

https://docs.docker.com/install/linux/docker-ce/centos/

从库安装

https://docs.docker.com/install/linux/docker-ce/centos/#install-using-the-repository

从文件安装

https://docs.docker.com/install/linux/docker-ce/centos/#install-from-a-package

https://download.docker.com/linux/centos/7/x86_64/stable/Packages/

https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-18.03.1.ce-1.el7.centos.x86_64.rpm

  1.1:删除旧版本的docker  

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

  1.2:用rpm包方法安装docker

wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-18.03.1.ce-1.el7.centos.x86_64.rpm
yum install /zz/docker-ce-18.03.1.ce-1.el7.centos.x86_64.rpm

已安装:
docker-ce.x86_64 0:18.03.1.ce-1.el7.centos

作为依赖被安装:
audit-libs-python.x86_64 0:2.8.4-4.el7 checkpolicy.x86_64 0:2.5-8.el7
container-selinux.noarch 2:2.74-1.el7 libcgroup.x86_64 0:0.41-20.el7
libsemanage-python.x86_64 0:2.5-14.el7 libtool-ltdl.x86_64 0:2.4.2-22.el7_3
pigz.x86_64 0:2.3.3-1.el7.centos policycoreutils-python.x86_64 0:2.5-29.el7_6.1
python-IPy.noarch 0:0.75-6.el7 setools-libs.x86_64 0:3.3.8-4.el7

完毕!

  

  1.3:运行hello-world:报错无法拉取镜像

[[email protected] zm]# docker run hello-world
Unable to find image ‘hello-world:latest‘ locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/library/hello-world/manifests/latest: net/http: TLS handshake timeout.
See ‘docker run --help‘.

      修改DNS:加入8.8.8.8

[[email protected] zm]# docker run hello-world
Unable to find image ‘hello-world:latest‘ locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete 
Digest: sha256:2557e3c07ed1e38f26e389462d03ed943586f744621577a99efb77324b0fe535
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/

[[email protected] zm]# 

  

 

以上是关于centos7安装docker的主要内容,如果未能解决你的问题,请参考以下文章

centos7使用docker安装es(elasticsearch)

基于Centos7安装Docker-registry2.0

如何在 CentOS 7 上安装 Docker

centOS7安装Docker CE

centos7之docker安装

CentOS7安装Docker