如何在沒有網路的情況下在Windows Server 2016上安裝Docker?

如何在沒有網路的情況下在Windows Server 2016上安裝Docker?

我正在嘗試在未連接到 Internet 的 Windows Server 2016 VM 上安裝 docker。官方 docker 文件沒有提供任何在沒有互聯網的情況下在 Windows Server 2016 VM 上安裝的建議,那麼我該如何實現這一點呢?

我在某處讀到一篇博客,說下載 docker.exe 和 dockerd.exe 檔案並將它們放在 C:\Windows\System32 中就足夠了,然後運行dockerd.exe --register-service就足以安裝 Docker。雖然這似乎“有效”(docker info有輸出),但嘗試從本地註冊表中提取圖像失敗(它只是凍結,沒有錯誤輸出)。此外,我注意到沒有 DockerNAT NIC 設置,我猜測還缺少其他我不知道的步驟。

答案1

Docker網站實際上記錄了整個過程。

  1. 在 PowerShell 命令提示字元中,在具有連線的電腦上下載安裝程式存檔。
invoke-webrequest -UseBasicparsing -Outfile docker-17.06.2-ee-7.zip https://download.docker.com/components/engine/windows-server/17.06/docker-17.06.2-ee-7.zip
  1. 將 zip 檔案複製到要安裝 Docker 的電腦。在 PowerShell 命令提示字元中,使用下列命令提取檔案、註冊並啟動 Docker 服務。
# Extract the archive.
Expand-Archive docker-17.06.2-ee-7.zip -DestinationPath $Env:ProgramFiles

# Clean up the zip file.
Remove-Item -Force docker-17.06.2-ee-7.zip

# Install Docker. This requires rebooting.
$null = Install-WindowsFeature containers

# Add Docker to the path for the current session.
$env:path += ";$env:ProgramFiles\docker"

# Optionally, modify PATH to persist across sessions.
$newPath = "$env:ProgramFiles\docker;" +
[Environment]::GetEnvironmentVariable("PATH",
[EnvironmentVariableTarget]::Machine)

[Environment]::SetEnvironmentVariable("PATH", $newPath,
[EnvironmentVariableTarget]::Machine)

# Register the Docker daemon as a service.
dockerd --register-service

# Start the Docker service.
Start-Service docker
  1. 透過執行 hello-world 容器來測試您的 Docker EE 安裝。
docker container run hello-world:nanoserver

安裝適用於 Windows Server 的 Docker 企業版

由於您未能提供您正在使用的 Windows Server 版本,因此下列資訊可能相關。

由於映像不相容問題,Windows Server 1709 目前不支援 Docker 通用控制平面。若要使用 UCP,目前請使用目前的 LTSB Windows 版本,而不是 1709。

相關內容