How to mount a NFS file share inside a Windows Docker Container
NickName:Felipe Daiello Ask DateTime:2021-10-21T20:13:04

How to mount a NFS file share inside a Windows Docker Container

I am running Docker on a Windows Server 2022. I need to start a Windows Container - must be a windows container because I am porting a Net Framework App that cannot run on Linux. My Windows Container needs to write uploaded files to a network share. I have read lots of discussion, but I could only find example on Linux containers.

Currently I am trying using a Docker Compose file. This is the compose file:

version: "3.9"  
services:  
web:  
    image: misterpanel  
    ports:  
        - "80:80"  
    volumes:  
        - misterpanel_images:/inetpub/wwwroot/Img  
volumes:  
    misterpanel_images:  
    driver: local  
    driver_opts:  
        type: cifs  
        o: username=<myysernane>,password=<mypassword>,rw,domain=<mydomain>
        device: "\\\\<server-ip-address>\\<files-share>"  

Misterpanel image was created FROM mcr.microsoft.com/dotnet/framework/aspnet

When running docker-compose up, I am getting the following error:

PS C:\Users\Administrator\docker> docker-compose up Creating volume "docker_misterpanel_images" with local driver ERROR: create docker_misterpanel_images: options are not supported on this platform

I have also tryed to map the network drive at the host, and then mount the bind when starting the container like this:

docker run -p 80:80 --dns 8.8.8.8 --mount type=bind,source=z:\,target=c:\inetpub\wwwroot\Img misterpanel

But then I get this error ( even with Z drive working at the host ):

docker: Error response from daemon: invalid mount config for type "bind": bind source path does not exist: z:.

I have tryed all the possible sintaxes for the source ( \Z\ and //Z/ for example )

I could only mount binds on the Windows Container to the local C: drive.

Does anyone has ever mounted a bind to a file share inside a Windows Container?

Any help will be appreciated.

Thanks,

Copyright Notice:Content Author:「Felipe Daiello」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/69661787/how-to-mount-a-nfs-file-share-inside-a-windows-docker-container

More about “How to mount a NFS file share inside a Windows Docker Container” related questions

How to mount a NFS file share inside a Windows Docker Container

I am running Docker on a Windows Server 2022. I need to start a Windows Container - must be a windows container because I am porting a Net Framework App that cannot run on Linux. My Windows Container

Show Detail

NFS Share Volume wont mount to Docker container

I am trying to mount an NFS share inside a docker container. I am using docker compose and my compose file is as follows: version: &quot;3.2&quot; volumes: movies: driver: local driver_o...

Show Detail

Mount NFS share on host to docker container using -v or --mount

I am trying to bind the docker container during its start with a directory mounted from NFS on the docker host machine. I can view the contents of the directory on the host machine where I mounted ...

Show Detail

NFS fileshare mount from inside an alpine based docker container running on AWS Fargate

I have a dockerised legacy JBOSS app deployed on AWS Fargate. There is an on-prem NFS file share with routing between the subnets enabled. Why can't I mount the NFS file share from inside the Docker

Show Detail

Docker - Can mount an NFS share into a container but not a sub-directory of it

I have an NFS share with the following properties: Mounted on my host on /nfs/external_disk Owner user is test_user with UID 1234 Group is test_group with GID 2222 Permissions is 750 I have a small

Show Detail

Mounting nfs shares inside docker container

Does anyone know how to mount nfs share inside docker container with centos base image? I've tried this command: mount server:/dir /mount/point and got the next error: mount.nfs: rpc.statd is not

Show Detail

Docker refuses to mount NFS share

I'm trying to mount an NFS(version 3) share, which exists on the host, into a docker container, but it's not working. Example: docker run -v /mnt/test001/:/mnt/test001/ hello-world This mount is...

Show Detail

Mount NFS share in docker in rootless mode

I am trying to mount an NFS share in a docker containe, but I cannot do so because the container running under rootlesskit does not have permissions to use escalate privileges on the host. Is there...

Show Detail

Mounting NFS shares inside docker container using shell script

I have an Ubuntu container running on a windows host. I have all of the nfs client packages installed. I can connect to my container and mount an nfs share. The idea is it start the container run my

Show Detail

Best option to access network share in docker windows container with Docker Compose

I am new to docker, so please bear with my naive questions. We are trying to host a dot net application in a Windows container. We were successful in hosting the application in the container. Howev...

Show Detail