OneGet / MicrosoftDockerProvider

Provider to search, save and install Docker
Other
135 stars 56 forks source link

Installing Docker inside a Windows Server Core container #73

Closed jviotti closed 4 years ago

jviotti commented 4 years ago

Mimicking a setup I have for GNU/Linux, I'm writing a Windows container whose task is to build and push other Windows containers. In order to do this, I'm trying to install Docker inside my Windows Server Core container.

I don't see any errors during the installation, but in fact no installation seems to be taking place for some reason. I think that the Get-SourceList function is executed, and then the installation successfully aborts, and I can't see Docker in Program Files as usual:

Step 1/8 : FROM mcr.microsoft.com/windows/servercore:ltsc2019
 ---> 561b89eac394
Step 3/8 : RUN powershell.exe Install-PackageProvider -Name NuGet -Force
 ---> Running in ce55aec589c7

Name                           Version          Source           Summary
----                           -------          ------           -------
nuget                          2.8.5.208        https://onege... NuGet provi...

Removing intermediate container ce55aec589c7
 ---> e3c0e9ee89da
Step 4/8 : RUN powershell.exe Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
 ---> Running in 25a7ec7c0157
Removing intermediate container 25a7ec7c0157
 ---> d52272580d18
Step 5/8 : RUN powershell.exe Install-Package -Name docker -ProviderName DockerMsftProvider -Confirm -Verbose
 ---> Running in ccb96cf6427c
VERBOSE: Importing package provider 'DockerMsftProvider'.
VERBOSE: Using the provider 'DockerMsftProvider' for searching packages.
VERBOSE: Download size: 0.02MB
VERBOSE: Free space on the drive: 20281.31MB
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.
Removing intermediate container ccb96cf6427c
 ---> 3774bb11f4dd

What do you think? Am I missing something?

jviotti commented 4 years ago

I tried passing the -Update option so get the Install-Package function to print this line:

if($options.ContainsKey('Update'))
{
    Write-Verbose "Updating the docker installation."
    $update = $true
}

I guess its not even running the install function for some reason?

StefanScherer commented 4 years ago

You cannot install Docker insider a Windows Container, the package installer will fail to start Docker service as the Containers feature cannot be installed inside a Windows Container. The only thing that could be teste if the install script theoretically would install the binaries, but I don't know if it's that what you want to do :-)

jviotti commented 4 years ago

Thanks for the info! I'll close this issue then.

What prevents the Containers feature from being installed inside a Windows Container in more detail btw? Do you think this is something that might be supported at some point?

twilly86 commented 3 years ago

Also looking for this to be supported. Would love to be able to build our docker images inside a docker container that is running azure devops agent. This would simplify our pipeline setup a ton.