Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions 3.2/windows/nanoserver/Dockerfile.1709
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM microsoft/powershell:6.0.1-nanoserver-1709

USER ContainerAdministrator

RUN setx /M PATH "%PATH%;%ProgramFiles%\PowerShell"
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
SHELL ["pwsh.exe", "-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 = ('C:\Redis;{0}' -f $env:PATH); \
Write-Host ('Updating PATH: {0}' -f $newPath); \
# Nano Server does not have "[Environment]::SetEnvironmentVariable()"
setx /M PATH $newPath;
# doing this first to share cache across versions more aggressively

ENV REDIS_VERSION 3.2.100

ADD https://github.com/MSOpenTech/redis/releases/download/win-${REDIS_VERSION }/Redis-x64-${REDIS_VERSION }.zip c:\redis.zip

RUN Write-Host 'Expanding ...'; \
Expand-Archive redis.zip -DestinationPath C:\Redis; \
\
Write-Host 'Verifying install ("redis-server --version") ...'; \
redis-server --version; \
\
Write-Host 'Removing ...'; \
Remove-Item redis.zip -Force

# disable Redis protected mode [1] as it is unnecessary in context of Docker
# (ports are not automatically exposed when running inside Docker, but rather explicitly by specifying -p / -P)
# [1]: https://github.com/antirez/redis/commit/edd4d555df57dc84265fdfb4ef59a4678832f6da
RUN (Get-Content C:\Redis\redis.windows.conf) \
-Replace '^(bind)\s+.*$', '$1 0.0.0.0' \
-Replace '^(protected-mode)\s+.*$', '$1 no' \
| Set-Content C:\Redis\redis.docker.conf

VOLUME C:\\data
WORKDIR C:\\data


EXPOSE 6379
CMD ["redis-server.exe", "C:\\Redis\\redis.docker.conf"]