Skip to content

Commit 1497727

Browse files
committed
Add "compose" and "buildx" CLI plugins to Windows CLI-only container
1 parent 06e0b8a commit 1497727

File tree

6 files changed

+251
-0
lines changed

6 files changed

+251
-0
lines changed

20.10/windows/windowsservercore-1809/Dockerfile

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

20.10/windows/windowsservercore-ltsc2022/Dockerfile

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

23.0/windows/windowsservercore-1809/Dockerfile

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

23.0/windows/windowsservercore-ltsc2022/Dockerfile

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile-windows-servercore.template

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,48 @@ RUN Write-Host ('Downloading {0} ...' -f $env:DOCKER_URL); \
3232
docker --version; \
3333
\
3434
Write-Host 'Complete.';
35+
36+
# https://github.com/docker-library/docker/issues/409#issuecomment-1462868414
37+
{{
38+
{
39+
buildx: .buildx,
40+
compose: .compose,
41+
}
42+
| to_entries | map(
43+
.key as $key | ($key | ascii_upcase) as $KEY | .value | (
44+
-}}
45+
ENV DOCKER_{{ $KEY }}_VERSION {{ .version }}
46+
ENV DOCKER_{{ $KEY }}_URL {{ .arches["windows-amd64"].url }}
47+
ENV DOCKER_{{ $KEY }}_SHA256 {{ .arches["windows-amd64"].sha256 }}
48+
RUN $dir = ('{0}\docker\cli-plugins' -f $env:ProgramFiles); \
49+
Write-Host ('Creating {0} ...' -f $dir); \
50+
New-Item -ItemType Directory $dir -Force; \
51+
\
52+
$plugin = ('{0}\docker-{{ $key }}.exe' -f $dir); \
53+
Write-Host ('Downloading {0} ...' -f $env:DOCKER_{{ $KEY }}_URL); \
54+
Invoke-WebRequest -Uri $env:DOCKER_{{ $KEY }}_URL -OutFile $plugin; \
55+
\
56+
Write-Host ('Verifying sha256 ({0}) ...' -f $env:DOCKER_{{ $KEY }}_SHA256); \
57+
if ((Get-FileHash $plugin -Algorithm sha256).Hash -ne $env:DOCKER_{{ $KEY }}_SHA256) { \
58+
Write-Host 'FAILED!'; \
59+
exit 1; \
60+
}; \
61+
\
62+
Write-Host 'Verifying install ("docker {{ $key }} version") ...'; \
63+
docker {{ $key }} version; \
64+
{{ if $key == "compose" then ( -}}
65+
\
66+
$link = ('{0}\docker\docker-{{ $key }}.exe' -f $env:ProgramFiles); \
67+
Write-Host ('Linking {0} to {1} ...' -f $plugin, $link); \
68+
New-Item -ItemType SymbolicLink -Path $link -Target $plugin; \
69+
\
70+
Write-Host 'Verifying install ("docker-{{ $key }} --version") ...'; \
71+
docker-{{ $key }} --version; \
72+
{{ ) else "" end -}}
73+
\
74+
Write-Host 'Complete.';
75+
{{
76+
)
77+
)
78+
| add
79+
-}}

apply-templates.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ for version; do
5959
;;
6060
esac
6161

62+
echo "processing $dir ..."
63+
6264
mkdir -p "$dir"
6365
{
6466
generated_warning

0 commit comments

Comments
 (0)