在win 10上安装好Docker后,根据官方文档示例运行命令:docker run hello-world
,报错:
C:\Users\stein>docker run hello-wrold
Unable to find image 'hello-wrold:latest' locally
docker: Error response from daemon: pull access denied for hello-wrold, repository does not exist or may require 'docker login'.
根据错误提示是:repository不存在或者需要运行docker login登录,但是根据官方文档:在docker hub中搜索或者拉去images时并不需要账户并且登录,如图1:
于是,转而去配置repository,事实发现并没有卵用,只好google之,在Stackoverflow上的这个回答Docker hello-world: authentication error中可以找到一些线索:
根据图2来看,还是需要使用账号和密码去登录的,不然也不会有那么多人问这个相关的问题;
于是乖乖的去创建Docker id,然后在运行docker run hello-world
命令之前先使用命令docker login
登录,过程如下:
C:\Users\stein>docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to [https://hub.docker.com](https://hub.docker.com/) to create one.
Username: daoyi
Password:
Login Succeeded
C:\Users\stein>docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pull complete
Digest: sha256:66ef312bbac49c39a89aa9bcc3cb4f3c9e7de3788c944158df3ee0176d32b751
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://cloud.docker.com/](https://cloud.docker.com/)
For more examples and ideas, visit:
[https://docs.docker.com/engine/userguide/](https://docs.docker.com/engine/userguide/)