在 Window 10 上安裝完 Docker 後,照著官方文件提到透過 powershell 下 command line 確認安裝是否正常,第一項輸入 docker version 正常順利執行,但下一步的 docker run hello-world 就沒那麼順利跳出無法正常執行,錯誤訊息如下所示
PS D:\> docker run hello-world Unable to find image 'hello-world:latest' locally C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: pull access denied for hello-world, repository does not exist or may require 'docker login'. See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'. PS D:\>
解決方式很簡單,在第一次使用 docker run 之前需先做登入的動作(印象中之前不用登入),可以透過兩種方式在 Docker 登入
第一種 : 在 Docker icon 按下右鍵 > 選擇 sign in
接著在 GUI 上輸入帳號密碼等資訊,即可正常執行
第二種 : 直接在 Powershell 上面打指令 docker login ,輸入 docker id & password 相關資訊,接著在重新執行一次官方文件的 hello-world 即可正常進行,說明如下
PS C:\Users\marcustung> docker login Login with your Docker ID to push and pull images from Docker Hub. If you dont have a Docker ID, head over to https://hub.docker.com to create one. Username: marcustung Password: Login Succeeded PS C:\Users\marcustung> 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/在3-5行可以看到輸入帳號密碼後顯示登入成功,接下來再使用 docker run hello-world 步驟即可看到 Hello from Docker! ,可以開始享受 Docker 的強大之處了!!!
參考
Docker hello-world: authentication error
0 意見:
張貼留言