microsoft/Windows-Containers

install-docker scripts failing when passing -useDHCP due to deprecated dependency

rholdorf opened this issue · 4 comments

the problem
On Windows Server 2022, the install-docker-ce.ps1 and install-containers-runtime.ps1 scripts will fail at the step Creating container network (Transparent)... as that depends on the New-ContainerNetwork cmdlet. That cmdlet is part of Docker PowerShell which is deprecated.

To Reproduce
On a Windows Server 2022 machine, with Hyper-V Role and Containers feature enabled, download the scripts, open an Administrator Windows PowerShell session and run ./install-docker-ce.ps1 -useDHCP.

It will start fine, and then will fail:

PS C:\Users\[user]\Downloads> .\install-docker-ce.ps1 -useDHCP
Querying status of Windows feature: Containers...
Feature Containers is already enabled.
Waiting for Hyper-V Management...
Enabling container networking...
Creating container network (Transparent)...
C:\Users\[user]\Downloads\install-docker-ce.ps1 : The term 'New-ContainerNetwork' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
At line:1 char:1
+ .\install-docker-ce.ps1 -useDHCP
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,install-docker-ce.ps1

Expected behavior
Docker should be installed, with Transparent networking.

Configuration:

  • Edition: Windows Server 2022
  • Base Image being used: Not applicable
  • Container engine: Not applicable
  • Container Engine version: Not applicable

Additional context
Fresh install, just Windows and .NET8, nothing else.

Thanks for bringing up this Issue. We've filed an internal bug to take a look at this (🔖 48876203).

@ritikaguptams has been tackling this Issue and put out a PR. We'll be reviewing that shortly and updating this Issue as soon as we can.

@rholdorf We have updated the scripts to use supported commands to create a transparent network to unblock the users! Cheers!

@rholdorf We have updated the scripts to use supported commands to create a transparent network to unblock the users! Cheers!

Great! The script worked beautifully. Thank you!