1.配置阿里云镜像加速服务。
进入 https://cr.console.aliyun.com/cn-qingdao/instances/mirrors
在虚拟机centos的目录下执行命令
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://3mnd11z0.mirror.aliyuncs.com"]
}
EOF
https://3mnd11z0.mirror.aliyuncs.com 是我的加速地址,每个人的地址不同。
sudo systemctl daemon-reload 重载文件
sudo systemctl restart docker 重启docker
1.Docker用镜像创建了容器并运行,
docker run hello-world
[root@test docker]# docker run hello-world
Unable to find image 'hello-world:latest' locally //找不到最新的镜像
latest: Pulling from library/hello-world //从仓库中拉取 hello-world镜像
0e03bdcc26d7: Pull complete
Digest: sha256:1a523af650137b8accdaed439c17d684df61ee4d74feac151b5b337bd29e7eec
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/