This will set up buildkitd
natively on Windows Server 2019 (ltsc2019) or Windows Server 2022 (ltsc2022).
This will reboot your server if the feature is not already installed.
Install-WindowsFeature -Name containers -Restart
package main | |
import ( | |
"context" | |
"fmt" | |
"log" | |
"os" | |
"os/signal" | |
"path/filepath" | |
"sync/atomic" |
$ErrorActionPreference="Stop" | |
$containerdDir = join-path $env:ProgramFiles containerd | |
if (!(Test-Path $containerdDir)){ | |
mkdir $containerdDir | |
} | |
$downloadPath = Join-Path $env:Tmp "containerd.tar.gz" | |
$downloadLink = "https://github.com/containerd/containerd/releases/download/v1.7.5/containerd-1.7.5-windows-amd64.tar.gz" |
package main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
"strings" | |
"github.com/Microsoft/go-winio" | |
"golang.org/x/sys/windows" |
C:\Users\Administrator\work\playground\with-drive-letter>docker build -t docker.samfira.com/volume-copy-up:2.6 . | |
Sending build context to Docker daemon 5.253MB | |
Step 1/19 : FROM mcr.microsoft.com/windows/nanoserver:ltsc2022 | |
ltsc2022: Pulling from windows/nanoserver | |
9e0d440fca83: Already exists | |
Digest: sha256:3bb312dcc36fa551766a13cf2fb8e2be90726774589c96bea9198a26307bf2a2 | |
Status: Downloaded newer image for mcr.microsoft.com/windows/nanoserver:ltsc2022 | |
---> 0c7fb865d8dc | |
Step 2/19 : ADD https://github.com/kubernetes-sigs/windows-testing/raw/3fea3d48ea8337b2aaca755c1d719e34b45f46b9/images/busybox/busybox.exe /bin/busybox.exe | |
Downloading [==================================================>] 575kB/575kB |
# Copyright The containerd Authors. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
Assumptions:
k8s-test
Obviously you will need to adust these assumptions to your env. But for clarity we define these assumptions here.
The scripts in this gist are mostly taken from the containerd repo with some small changes. Feel free to inspect them and see what they do.
# If the feature is not already installed, this will install it
# and reboot your machine.
Install-WindowsFeature -Name Containers -Restart
$ErrorActionPreference="Stop" | |
# Considerable performance boost withour realtime monitoring. | |
# This is usually okay on temporary test systems. Don't do this | |
# on your own machine. | |
Set-MpPreference -DisableRealtimeMonitoring:$true | |
wget -UseBasicParsing -OutFile "$HOME\prepare_env_windows.ps1" -Uri https://gist.githubusercontent.com/gabriel-samfira/c80ccb1d79be737e5e61214181e48ad8/raw/4aa3d3efe643f70c9b8bcd139b3afca798900262/prepare_env_windows.ps1 | |
& "$HOME\prepare_env_windows.ps1" |
# Prepare windows environment for building and running containerd tests | |
$PACKAGES= @{ mingw = "12.2.0"; git = ""; golang = ""; make = ""} | |
Write-Host "Downloading chocolatey package" | |
curl.exe -L "https://packages.chocolatey.org/chocolatey.0.10.15.nupkg" -o 'c:\choco.zip' | |
Expand-Archive "c:\choco.zip" -DestinationPath "c:\choco" | |
Write-Host "Installing choco" | |
& "c:\choco\tools\chocolateyInstall.ps1" |