
我已經下載了“Docker for Windows Installer”,並在 Windows 10 電腦中使用選項“Linux Container”運行安裝程式。安裝成功。 Hyper-v 已啟用。也啟用了虛擬化。
我可以成功運行命令 docker --version。但是當我嘗試運行“docker run hello-world”時,我收到以下錯誤:
無法在本機找到映像「hello-world:最新」C:\ Program Files \ Docker \ Docker \ Resources \ bin \ docker.exe:來自守護程式的錯誤回應:取得https://registry-1.docker.io/v2/library/hello-world/manifests/latest:等待連線時請求被取消(等待標頭時超出了 Client.Timeout)。請參閱「C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help」。
當我選擇切換到Windows容器時,我可以成功運行docker映像。但當我切換回 Linux Container 時,我再次面臨同樣的問題。
我已經檢查了設定中的 DNS 8.8.8.8,也嘗試重新啟動 docker,但到目前為止沒有幫助。
另外,當我切換到 Windows 容器並嘗試執行 Dockerfile 時,我收到以下錯誤:
將建置上下文傳送至 Docker 守護程式 113.2kB 步驟 1/4:FROM java:8 8:從庫/java 映像中拉取 作業系統「linux」不能在此平台上使用
請幫我。
答案1
安裝最新版本,解決了我的問題。我能夠在 Linux 和 Windows 上運行容器。 hello-world 映像正在運作。
我已採取以下步驟:
1. Uninstall Docker for Desktop.
2. Remove docker folder and files from AppData : Local and Roaming.
3. Remove docker folder from Program data
4. Remoce .docker inside <C:\Users\UserName\> folder.
5. Remove temp files
6. Download latest version (my version : 2.3.0.2)
7. Install Docker
8. Enable Kubernetes.
我現在可以建立 docker 映像並運行容器,使用 kubernetes,編排一切都運作良好。但我使用的是 Linux 容器。因為我不想要 Windows 容器。