Skip to content

Instantly share code, notes, and snippets.

@bzuillsmith
Created January 24, 2023 02:42
Show Gist options
  • Save bzuillsmith/c394aa7460463268459d03cbc48668a5 to your computer and use it in GitHub Desktop.
Save bzuillsmith/c394aa7460463268459d03cbc48668a5 to your computer and use it in GitHub Desktop.
Setting up a windows container in Docker

I thought WSL 2 somehow also supported windows containers but Docker 4.13.1 indicates that Hyper-V is required. 4.16.x just wouldn't work and gave a .//pipe/docker_engine-windows related exception. Could be that it didn't give a proper error message when Hyper-V was missing.

On 4.13.1 I got it running.

Setting up the mcr.microsoft.com/dotnet/framework/sdk:latest image

  1. I didn't immediately have internet. To fix this I had to add dns: [8.8.8.8] to the docker engine daemon.json settings.

  2. After step 1, TLS failed. This old image doesn't have Tls12 turned on by default. Enable it with the following run in the container

    [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
    

Install AWS CLI on windows Container

$command = "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12"
Invoke-Expression $command
Invoke-WebRequest -Uri "https://awscli.amazonaws.com/AWSCLIV2.msi" -Outfile C:\AWSCLIV2.msi
$arguments = "/i `"C:\AWSCLIV2.msi`" /quiet"
Start-Process msiexec.exe -ArgumentList $arguments -Wait
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine")
aws --version
aws s3 ls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment