docker(镜像加速器)
接上篇:docker(centos7.9安装docker)
1、注册一个属于自己的阿里云账户(可复用淘宝账户)
https://promotion.aliyun.com/ntms/act/kubernetes.html
2、获得加速器地址链接
3、粘贴脚本直接执行
-- 当前在 /etc/docker 目录下 [root@hadoop100 docker]# pwd /etc/docker -- 直接脚本,配置镜像加速器 [root@hadoop100 docker]# tee /etc/docker/daemon.json <<-'EOF' > { > "registry-mirrors": ["https://59aqvy0q.mirror.aliyuncs.com"] > } > EOF { "registry-mirrors": ["https://59aqvy0q.mirror.aliyuncs.com"] } -- 激活配置文件 [root@hadoop100 docker]# systemctl daemon-reload -- 重启docker [root@hadoop100 docker]# systemctl restart docker [root@hadoop100 docker]#
4、重启docker服务器
docker run hello-world
-- 运行hello-world,能打印出消息,说明docker配置了镜像加速器能成功运行 [root@hadoop100 docker]# docker run hello-world 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/ [root@hadoop100 docker]#
run干了什么?
为什么docker会比VM虚拟机快