Why?
Well I need to run a container with a pre-defined MAC address. So I want to create a wrapper container to run normal in Kubernetes, but within this container have it run a “nested” container assigning it a MAC address for licencing comparability. It’s part of a legacy project.
How? Well I am having problems getting containers enabled in the windows base images. It looks like the feature has been removed and I don’t know how to get it installed.
I have tried:
FROM mcr.microsoft.com/windows/servercore:ltsc2019
USER ContainerAdministrator
SHELL ["powershell", "-command"]
RUN Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
RUN Install-PackageProvider -Name NuGet -Force
RUN Install-Module -Name DockerMsftProvider -Force
RUN Import-Module -Name DockerMsftProvider -Force
RUN Import-Packageprovider -Name DockerMsftProvider -Force
RUN Install-Package -Name docker -ProviderName DockerMsftProvider -Verbose -Update -Force
Only to get the below error:
Step 10/11 : RUN Install-Package -Name docker -ProviderName DockerMsftProvider -Verbose -Update -Force
---> Running in db1c178e0138
VERBOSE: Importing package provider 'DockerMsftProvider'.
VERBOSE: Using the provider 'DockerMsftProvider' for searching packages.
VERBOSE: Download size: 0.03MB
VERBOSE: Free space on the drive: 20230.97MB
VERBOSE: Downloading
https://dockermsft.azureedge.net/dockercontainer/DockerMsftIndex.json to
C:\Users\ContainerAdministrator\AppData\Local\Temp\DockerMsftProvider\DockerDef
ault_DockerSearchIndex.json
VERBOSE: About to download
VERBOSE: Finished downloading
VERBOSE: Downloaded in 0 hours, 0 minutes, 0 seconds.
VERBOSE: Performing the operation "Install Package" on target "Package 'Docker'
version '19.03.13' from 'DockerDefault'.".
VERBOSE: Updating the docker installation.
VERBOSE: Installing Containers feature...
VERBOSE: Installed Containers feature
VERBOSE: Download size: 85.7MB
VERBOSE: Free space on the drive: 20095.43MB
VERBOSE: Downloading
https://dockermsft.azureedge.net/dockercontainer/docker-19-03-13.zip to
C:\Users\ContainerAdministrator\AppData\Local\Temp\DockerMsftProvider\Docker-19
-03-13.zip
VERBOSE: About to download
VERBOSE: Finished downloading
VERBOSE: Downloaded in 0 hours, 0 minutes, 13 seconds.
VERBOSE: Verifying Hash of the downloaded file.
VERBOSE: Hash verified!
VERBOSE: Found
C:\Users\ContainerAdministrator\AppData\Local\Temp\DockerMsftProvider\Docker-19
-03-13.zip to install.
VERBOSE: Trying to unzip :
C:\Users\ContainerAdministrator\AppData\Local\Temp\DockerMsftProvider\Docker-19
-03-13.zip
VERBOSE: Preparing to expand...
VERBOSE: Adding 'C:\Program Files\docker\'.
VERBOSE: Created 'C:\Program Files\docker\docker.exe'.
VERBOSE: Created 'C:\Program Files\docker\vcruntime140.dll'.
VERBOSE: Created 'C:\Program Files\docker\licenses.txt'.
VERBOSE: Created 'C:\Program Files\docker\libeay32.dll'.
VERBOSE: Created 'C:\Program Files\docker\dockerd.exe'.
VERBOSE: Created 'C:\Program Files\docker\ssleay32.dll'.
VERBOSE: Created 'C:\Program Files\docker\libwinpthread-1.dll'.
VERBOSE: Adding 'C:\Program Files\docker\cli-plugins\'.
VERBOSE: Created 'C:\Program Files\docker\cli-plugins\docker-registry.exe'.
VERBOSE: Created 'C:\Program Files\docker\cli-plugins\docker-app.exe'.
VERBOSE: Created 'C:\Program Files\docker\cli-plugins\docker-cluster.exe'.
VERBOSE: Trying to enable the docker service...
VERBOSE: Removing the archive:
C:\Users\ContainerAdministrator\AppData\Local\Temp\DockerMsftProvider\Docker-19
-03-13.zip
WARNING: A restart is required to enable the containers feature. Please restart
your machine.
Install-Package : The request to add or remove features on the specified
server failed.
Installation of one or more roles, role services, or features failed.
The source files could not be found.
Use the "Source" option to specify the location of the files that are required
to restore the feature. For more information on specifying a source location,
see http://go.microsoft.com/fwlink/?LinkId=243077. Error: 0x800f081f
At line:1 char:1
+ Install-Package -Name docker -ProviderName DockerMsftProvider -Verbos ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (@{Vhd=; Credent...Name=localh
ost}:String) [Install-Package], Exception
+ FullyQualifiedErrorId : DISMAPI_Error__Failed_To_Enable_Updates,Microsof
t.Windows.ServerManager.Commands.AddWindowsFeatureCommand,Microsoft.PowerS
hell.PackageManagement.Cmdlets.InstallPackage
**I also Tried adding **
RUN Install-WindowsFeature containers
Only to get the below error:
Step 6/12 : RUN Install-WindowsFeature containers
---> Running in 1de051129232
Install-WindowsFeature : The request to add or remove features on the
specified server failed.
Installation of one or more roles, role services, or features failed.
The source files could not be found.
Use the "Source" option to specify the location of the files that are required
to restore the feature. For more information on specifying a source location,
see http://go.microsoft.com/fwlink/?LinkId=243077. Error: 0x800f081f
At line:1 char:1
+ Install-WindowsFeature containers
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (@{Vhd=; Credent...Name=localh
ost}:PSObject) [Install-WindowsFeature], Exception
+ FullyQualifiedErrorId : DISMAPI_Error__Failed_To_Enable_Updates,Microsof
t.Windows.ServerManager.Commands.AddWindowsFeatureCommand
I don’t know how where or how to get these files ?
Another option I thought was to just build a new Windows Base image with the feature added… but I’m not sure how to build a windows base image from scratch?
Any help appreciated …