question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error with MongoDb image & volume mount

See original GitHub issue

When starting the nanoserver MongoDB image with a volume I the container doesn’t start and I get a cryptic error

docker run --rm -it --mount source=myvol,target=c:/Data/db stefanscherer/mongo-windows:latest

docker: Error response from daemon: container 
7c2a36d7fe3dcf608eb1b8afd16fcc4ad0573db464a5d5ad863d3cc0041b411c 
encountered an error during CreateContainer: failure in a Windows system call: The request is not supported. (0x32) 

<rest of message removed>

If I remove the volume mount it starts perfectly OK. I’m seeing this problem locally (Windows 10 - Docker Version 17.12.0-ce-win47 (15139)) and also when running the container in Azure

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
StefanScherercommented, Apr 21, 2018

Seems like the VOLUME C:\data\db instruction makes problems with 1709. It leaves a container mapped directory link in the mongo image which then cannot be mounted with 1709 server at runtime.

And the nanoserver image must be run with -u ContainerAdministrator to have access to the mounted volume. Weird.

This Dockerfile seems to work building and running on a 1709 machine

# escape=`
FROM microsoft/windowsservercore:1709 as msi

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

ENV MONGO_VERSION 3.4.14
ENV MONGO_DOWNLOAD_URL http://downloads.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-${MONGO_VERSION}-signed.msi
ENV MONGO_DOWNLOAD_SHA256 0cb34aecb4ae50680a895ea9ebd1516d28eb1498b47faf63d9f065eb6548fcb9

RUN Write-Host ('Downloading {0} ...' -f $env:MONGO_DOWNLOAD_URL)
RUN Invoke-WebRequest -Uri $env:MONGO_DOWNLOAD_URL -OutFile 'mongodb.msi'
RUN Write-Host ('Verifying sha256 ({0}) ...' -f $env:MONGO_DOWNLOAD_SHA256)
RUN if ((Get-FileHash mongodb.msi -Algorithm sha256).Hash -ne $env:MONGO_DOWNLOAD_SHA256) { `
      Write-Host 'FAILED!'; `
      exit 1; `
    }
RUN Start-Process msiexec.exe -ArgumentList '/i', 'mongodb.msi', '/quiet', '/norestart', 'INSTALLLOCATION=C:\mongodb', 'ADDLOCAL=Server,Client,MonitoringTools,ImportExportTools,MiscellaneousTools' -NoNewWindow -Wait
RUN Remove-Item C:\mongodb\bin\*.pdb
RUN mkdir C:\data\db

FROM microsoft/nanoserver:1709

COPY --from=msi C:\mongodb\ C:\mongodb\
COPY --from=msi C:\windows\system32\msvcp140.dll C:\windows\system32
COPY --from=msi C:\windows\system32\vcruntime140.dll C:\windows\system32
COPY --from=msi C:\data\db\ C:\data\db\

EXPOSE 27017

USER ContainerAdministrator

CMD ["C:\\mongodb\\bin\\mongod.exe"]
1reaction
benc-ukcommented, May 24, 2018

FYI this container worked ok, thanks for your help and thanks for these images you are making available to the community. These have become the defacto images for things like Node and Mongo on Windows so thanks for your efforts

Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker image: Error response from daemon: cannot mount ...
When you commit the container and try to relaunch it, it has some sort of record that something should be mounted there, and...
Read more >
Issues with mongo with mounted volume for data
I've set up Docker to share the drive where my docker-compose file is located. My docker-compose: some-mongo: image: "mongo:latest" volumes:
Read more >
Docker User Number - Ops and Admin - MongoDB
Hi, I am running mongodb using docker compose. Within the container the /data folder is owned by mongodb which is user number 999....
Read more >
pods unable to access mounted volumes - Google Groups
It is set to the image not running with root privs. If you want a work around, i did an example with an...
Read more >
MongoDB | Using Images | OpenShift Container Platform 3.11
If you do not specify all four, the pod will fail to start and OpenShift ... The MongoDB image can be run with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found