-
Notifications
You must be signed in to change notification settings - Fork 633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build mongo:3.4.0-nanoserver #124
Comments
If Visual C++ Redistributable 2015 is install-able in nanoserver, then we use that to get Here is a quick untested copy from the golang image (still needs the download and extract of visual C++): FROM microsoft/nanoserver
# $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 = ('C:\mongodb\bin;{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
****** TODO, install Visual C++ Redistributable 2015 (and anything else that might be required)
ENV MONGO_VERSION 3.4.0
ENV MONGO_ARCHIVE_DIR mongodb-win32-x86_64-2008plus-ssl-${MONGO_VERSION}
ENV MONGO_DOWNLOAD_URL http://downloads.mongodb.org/win32/${MONGO_ARCHIVE_DIR}.zip
ENV MONGO_DOWNLOAD_SHA256 c4dd867fef653b8f3534ba563171179665486632814519a1c34228c5557f3ced
RUN Write-Host ('Downloading {0} ...' -f $env:MONGO_DOWNLOAD_URL); \
Invoke-WebRequest -Uri $env:MONGO_DOWNLOAD_URL -OutFile 'mongo.zip'; \
\
Write-Host ('Verifying sha256 ({0}) ...' -f $env:MONGO_DOWNLOAD_SHA256); \
if ((Get-FileHash mongo.zip -Algorithm sha256).Hash -ne $env:MONGO_DOWNLOAD_SHA256) { \
Write-Host 'FAILED!'; \
exit 1; \
}; \
\
Write-Host 'Expanding ...'; \
Expand-Archive mongo.zip -DestinationPath C:\; \
Move-Item -Path ('C:\{0}' -f $env:MONGO_ARCHIVE_DIR) -Destination 'C:\mongodb'; \
\
Write-Host 'Verifying install ("mongo --version") ...'; \
mongo --version; \
\
Write-Host 'Removing ...'; \
Remove-Item mongo.zip -Force; \
\
Write-Host 'Complete.'; |
The ZIP file, although called "plus-ssl", lacks the OpenSSL DLL's. That's why I use the MSI and extract and copy everything into a smaller image.
|
The problem with copying artifacts from Does Microsoft not yet have an official (or even semi-official) solution for installing the Visual C++ runtime in Nano Server? 😞 For the SSL issue, we could punt for now and use the non-SSL releases from upstream (until we find a good way to extract their SSL DLLs directly, they include them, or we find compatible replacements somewhere), but the VC++ runtime issue is more pressing IMO because we can't run MongoDB at all without that, currently. |
Don't know about the runtime. AFAIK they are only available as exe installers and may not be installable directly in nanoserver. What about one CI build for both |
If this repo were responsible for publishing artifacts directly, that would work, but if this repo were publishing artifacts directly, then different official images would have a difference cadence/process for updates (and make it hard for users to trace back to the |
In the meantime here is an inofficial Docker image for MongoDB 3.4.1 for nanoserver, built with AppVeyor + a Windows Docker engine running in Azure using this build.bat steps. |
After the announcements at DockerCon (ok, I tried it a little earlier) I have put the NanoServer build into one multi-stage Should we then provide only the nanoserver image for such products like MongoDB? IMHO then there is no need for a windowsservercore image. |
@StefanScherer I have tried to run your image
I am launching container with the following commandline: Do I miss some parameter(s)? |
@minherz I tried it on Windows Server 2016 and I cannot find this error message in the logs. I also use a bind mount to have the data on the host. Maybe Windows Defender has disturbed the containerized processes? mkdir mongo
docker container run -d -p 27017:27017 -v "$(pwd)\mongo:C:\data\db" --name mongodb stefanscherer/mongo-windows:3.4.4-nano
dir mongo
docker container logs $(docker container ls -lq) |
@StefanScherer I get the error when I run the image in Windows 10. In Windows Server 2016 it is running OK. I will check its work with explicit volume definition and not the temporary docker storage and will let you know. |
@StefanScherer running container with explicitly defined (and existing) volume location indeed worked for Windows 10. |
Threading multistage build issue, docker-library/official-images#3383, since MongoDB on nanoserver would currently require that. |
This is fixed via #470 😄 |
After a longer investigation in https://jira.mongodb.org/browse/SERVER-27182 Mark Benvenuto found out that MongoDB 3.4 is working in NanoServer.
My approach uses a simple COPY deployment as the MSI package can't be installed in NanoServer.
How should an official Dockerfile look like?
The text was updated successfully, but these errors were encountered: