安装docker-centos

安装docker

卸载旧版docker

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

如果yum报告未安装这些软件包,则可以。

配置docker的yum源

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

机子自身配置好epel源以及阿里云的源

yum install docker-ce docker-ce-cli containerd.io -y?systemctl start docker?

验证:

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: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fhello-world%3Apull&service=registry.docker.io: net/http: TLS handshake timeout. See ‘docker run --help‘.

证明你没有设置加速器。国内有限制

所以咱们就是去阿里云找一个属于自己的加速连接

mkdir -p /etc/docker ?tee /etc/docker/daemon.json <<-‘EOF‘ {  "registry-mirrors": ["https://ka8o6acz.mirror.aliyuncs.com"]}EOF?systemctl daemon-reload ?systemctl restart docker?在来一次:docker run hello-world?

输出:

……Hello from Docker!……

证明成功了!