Docker 在 CentOS 下的安装、使用_dial tcp lookup localhost on 10

深知大多数程序员,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!


img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上鸿蒙开发知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

需要这份系统化的资料的朋友,可以戳这里获取

[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF


注意,只能用`[Ctrl]d`结束,而不能用`[Ctrl]c`了


4.安装 Docker 包



$ sudo yum install docker-engine


出现下面错误



Loaded plugins: fastestmirror


就是 fastestmirror 插件错误,可以禁用该插件也可以暂时不理会,这并不影响 docker-engine 的安装。


禁用该 fastestmirror 插件



vi /etc/yum/pluginconf.d/fastestmirror.conf
enabled=1改成0


### 启动 docker 守护进程



$ sudo systemctl start docker.service


### 配置让 docker 服务随系统自动启动



$ sudo chkconfig docker on


### 验证 docker 是否安装成功



$ sudo systemctl enable docker.service


如果出错:



[waylau@waylau ~]$ sudo docker run hello-world
[sudo] password for waylau:
Sorry, try again.
[sudo] password for waylau:
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: dial tcp: lookup auth.docker.io on 8.8.8.8:53: no such host.


添加当前用户`waylau`到 docker 用户组



$ sudo usermod -aG docker waylau


并重复多几次(最好能翻墙,毕竟服务器在国外)最后成功的界面如下:



[waylau@waylau ~]$ sudo docker run hello-world
Unable to find image ‘hello-world:latest’ locally
Pulling repository docker.io/library/hello-world
975b84d108f1: Pull complete
3f12c794407e: Pull complete
Status: Downloaded newer image for hello-world:latest
docker.io/library/hello-world: this image was pulled from a legacy registry. Important: This registry version will not be supported in future versions of docker.

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 bash

Share images, automate workflows, and more with a free Docker Hub account:
https://hub.docker.com

For more examples and ideas, visit:
https://docs.docker.com/userguide/


整个过程是这样的:


1. Docker 客户端连接到 Docker 守护进程;
2. Docker 守护进程从 Docker Hub 中拉取名为 “hello-world” 的 image(镜像);
3. Docker 守护程序从该 image 中创建新的容器,该容器执行输出动作,输出的内容就是上面所看到的;
4. Docker 守护程序将输出流到 Docker 客户端并发送你的终端显示。


### 查看 docker image



![img](https://img-blog.csdnimg.cn/img_convert/e50ae8270cc59ebb0c9093085ce81fb4.png)
![img](https://img-blog.csdnimg.cn/img_convert/67eb0637f7b614fe4c56b0f138fe83e0.png)

**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**

**[需要这份系统化的资料的朋友,可以戳这里获取](https://bbs.youkuaiyun.com/topics/618636735)**


**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**

的资料的朋友,可以戳这里获取](https://bbs.youkuaiyun.com/topics/618636735)**


**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值