forked from docker-library/docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-windows-windowsservercore.template
35 lines (31 loc) · 1.54 KB
/
Dockerfile-windows-windowsservercore.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
FROM microsoft/windowsservercore:%%TAG%%
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# PATH isn't actually set in the Docker image, so we have to set it from within the container
RUN $newPath = ('{0}\docker;{1}' -f $env:ProgramFiles, $env:PATH); \
Write-Host ('Updating PATH: {0}' -f $newPath); \
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine);
# doing this first to share cache across versions more aggressively
ENV DOCKER_CHANNEL %%DOCKER-CHANNEL%%
ENV DOCKER_VERSION %%DOCKER-VERSION%%
# TODO ENV DOCKER_SHA256
# https://github.com/docker/docker-ce/blob/5b073ee2cf564edee5adca05eee574142f7627bb/components/packaging/static/hash_files !!
# (no SHA file artifacts on download.docker.com yet as of 2017-06-07 though)
RUN $url = ('https://download.docker.com/win/static/{0}/x86_64/docker-{1}.zip' -f $env:DOCKER_CHANNEL, $env:DOCKER_VERSION); \
Write-Host ('Downloading {0} ...' -f $url); \
Invoke-WebRequest -Uri $url -OutFile 'docker.zip'; \
\
Write-Host 'Expanding ...'; \
Expand-Archive docker.zip -DestinationPath $env:ProgramFiles; \
# (this archive has a "docker/..." directory in it already)
\
Write-Host 'Removing ...'; \
Remove-Item @( \
'docker.zip', \
('{0}\docker\dockerd.exe' -f $env:ProgramFiles) \
) -Force; \
\
Write-Host 'Verifying install ("docker --version") ...'; \
docker --version; \
\
Write-Host 'Complete.';