Patrick Magee
Patrick Magee

Reputation: 2989

Docker Windows Containers and NFS Volume

I have successfully created a Windows Docker Image and I can successfully run the container with docker-compose, for full functionality the application expects a folder location to exist, which is currently a NFS attached drive that contains a folder inside it that the application reads and writes to and is also used by other applications.

I have tried to find valid examples and documentation on Docker for Windows, Windows Containers and Docker Compose for Volumes that are NFS.

This is what I am currently trying

version: "3.4"

services:
  service:
    build:
      context: .
      dockerfile: ./Dockerfile
    image: imageName
    ports:
      - 8085:80
    environment:
      -
    volumes:
      - type: volume
        source: nfs_example 
        target: C:\example
        volume:
          nocopy: true
volumes:
  nfs_example:
    driver: local
    driver_opts: 
      type: "nfs"
      o: "addr=\\fileserver.domain,nolock,soft,rw"
      device: ":\\Shared\\Folder"

The error message I get is:

ERROR: create service_nfs_example: options are not supported on this platform

Upvotes: 2

Views: 5077

Answers (1)

Patrick Magee
Patrick Magee

Reputation: 2989

NFS doesn't work.I solved it using SMB on the host, then mounted that volume.

New-SmbGlobalMapping -RemotePath \\contosofileserver\share1 -Credential Get-Credentials -LocalPath G:
version: "3.4"

services:
  service:
    build:
      context: .
      dockerfile: ./Dockerfile
    image: imageName
    ports:
      - 8085:80
    environment:
      -
    volumes:
      - type: bind
        source: G:\share1
        target: C:\inside\container

This microsoft documentation on the windows containers helped me achieve this.

Upvotes: 4

Related Questions