如何在没有互联网的情况下在 Windows Server 2016 上安装 Docker?

riq*_*ang 7 windows-installation docker-for-windows

我正在尝试在未连接到 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 设置,我猜想还缺少其他我不知道的步骤。

Ram*_*und 9

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
Run Code Online (Sandbox Code Playgroud)
  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
Run Code Online (Sandbox Code Playgroud)
  1. 通过运行 hello-world 容器测试您的 Docker EE 安装。
docker container run hello-world:nanoserver
Run Code Online (Sandbox Code Playgroud)

为 Windows Server 安装 Docker 企业版

由于您未能提供您使用的 Windows Server 版本,因此以下信息可能相关。

由于图像不兼容问题,Windows Server 1709 目前不支持 Docker 通用控制平面。要使用 UCP,请暂时使用当前的 LTSB Windows 版本而不是 1709。