Created
December 1, 2017 01:25
-
-
Save kkbruce/d6740cd095a1891ad3f1d0b797609379 to your computer and use it in GitHub Desktop.
Redis for Windows Server Core Container Dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # escape=` | |
| # The MSI installs a service which is hard to override, so let's use a zip file. | |
| FROM microsoft/windowsservercore | |
| #MAINTAINER [email protected] | |
| LABEL maintainer="[email protected]" | |
| SHELL ["powershell"] | |
| RUN $ErrorActionPreference = 'Stop'; ` | |
| wget https://github.com/MSOpenTech/redis/releases/download/win-3.2.100/Redis-x64-3.2.100.zip -OutFile Redis-x64-3.2.100.zip ; ` | |
| Expand-Archive Redis-x64-3.2.100.zip -dest 'C:\Program Files\Redis\' ; ` | |
| Remove-Item Redis-x64-3.2.100.zip -Force | |
| RUN setx PATH '%PATH%;C:\Program Files\Redis\' | |
| WORKDIR 'C:\Program Files\Redis\' | |
| RUN Get-Content redis.windows.conf | Where { $_ -notmatch 'bind 127.0.0.1' } | Set-Content redis.openport.conf ; ` | |
| Get-Content redis.openport.conf | Where { $_ -notmatch 'protected-mode yes' } | Set-Content redis.unprotected.conf ; ` | |
| Add-Content redis.unprotected.conf 'protected-mode no' ; ` | |
| Add-Content redis.unprotected.conf 'bind 0.0.0.0' ; ` | |
| Get-Content redis.unprotected.conf | |
| EXPOSE 6379 | |
| # Define our command to be run when launching the container | |
| CMD .\redis-server.exe .\redis.unprotected.conf --port 6379 ; ` | |
| Write-Host Redis Started... ; ` | |
| while ($true) { Start-Sleep -Seconds 3600 } | |
| # Create Redis-Server | |
| # docker run --name redis-server -d -p 6379:6379 kkbruce/windowsredis:3.2.100 | |
| # Create Redis-cli | |
| # docker run --name redis-cli -ti kkbruce/windowsredis:3.2.100 .\redis-cli.exe -h 172.26.142.218 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment