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

667 Views Asked by At

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,

0

There are 0 best solutions below