Containers,  Microsoft

Docker Oh Docker

The  dark world of Containers and Images…oh my.  As I step my feet back into the Container World… and bring back the horror that is Hyper-V… I am reminded that my personally built Mage Dev PC does not really fully support the whole of Hyper-V- as least not how Docker Desktop wants to use it. Ya, it work fine on my ThinkPads (including my mini- Yoga X1)… but alas not the main desktop dev.  Oh woe!

But wait… there is a way…. I ran across this blog entry Docker without Hyper-V … and it really works… The long and short of it…. two methods to the madness…

Option 1 script:

# Install Windows feature containers
$restartNeeded = $false
if (!(Get-WindowsOptionalFeature -FeatureName containers -Online).State -eq 'Enabled') {
    $restartNeeded = (Enable-WindowsOptionalFeature -FeatureName containers -Online).RestartNeeded

if (Get-Service docker -ErrorAction SilentlyContinue)
    Stop-Service docker

# Download the zip file.
$json = Invoke-WebRequest | ConvertFrom-Json
$stableversion = $json.channels.stable.alias
$version = $json.channels.$stableversion.version
$url = $json.versions.$version.url
$zipfile = Join-Path "$env:USERPROFILE\Downloads\" $json.versions.$version.url.Split('/')[-1]
Invoke-WebRequest -UseBasicparsing -Outfile $zipfile -Uri $url

# Extract the archive.
Expand-Archive $zipfile -DestinationPath $Env:ProgramFiles -Force

# Modify PATH to persist across sessions.
$newPath = [Environment]::GetEnvironmentVariable("PATH",[EnvironmentVariableTarget]::Machine) + ";$env:ProgramFiles\docker"
$splittedPath = $newPath -split ';'
$cleanedPath = $splittedPath | Sort-Object -Unique
$newPath = $cleanedPath -join ';'
[Environment]::SetEnvironmentVariable("PATH", $newPath, [EnvironmentVariableTarget]::Machine)
$env:path = $newPath

# Register the Docker daemon as a service.
if (!(Get-Service docker -ErrorAction SilentlyContinue)) {
  dockerd --exec-opt isolation=process --register-service

# Start the Docker service.
if ($restartNeeded) {
    Write-Host 'A restart is needed to finish the installation' -ForegroundColor Green
    If ((Read-Host 'Do you want to restart now? [Y/N]') -eq 'Y') {
} else {
    Start-Service docker

This works just fine… and Option 2 (use DockerMsftProvider)


$paths = $env:psmodulePath.Split(';')
$modulePath = Join-Path $paths[0] "DockerMsftProvider"
if (!(Test-Path $modulePath)) {
  New-Item -Path $modulePath -ItemType Directory
$outfile = Join-Path $modulePath 'DockerMsftProvider.psm1'
Invoke-WebRequest -UseBasicParsing -OutFile $outfile -Uri

$outfile = Join-Path $modulePath 'DockerMsftProvider.psd1'
Invoke-WebRequest -UseBasicParsing -OutFile $outfile

Install-Package Docker -ProviderName DockerMsftProvider -Force

Now Option 2 – don’t forget to do a Start-Service docker … or things will complain…

Now I did change up the module path a bit to push docker up to my system module area instead of to my user’s doc path… and I did notice that Option 2 got a newer version of docker… Oh well you choose.

And yes docker commands work… Kitematic works… and Portainer works…

Btw if you want Portainer… 

docker pull portainer/portainer
docker run -d --restart always --name portainer --isolation process -h portainer -p 9000:9000 -v //./pipe/docker_engine://./pipe/docker_engine portainer/portainer

There you go!



Leave a Reply