docker-compose volumes mount to nas-folder (nfs)

4k views Asked by At

i have a problem with my docker-compose file. i get a error while bringing up the project after docker-compose up. i have a synology nas with an network share. smb and nfs is enabled. from my pc, i have no problems to connect to the share. but starting the container ends with the following error.

the error is:

ERROR: for paperless_webserver_1  Cannot create container for service webserver: failed to mount local volume: mount /volume1/paperless/data:/var/lib/docker/volumes/paperless_data/_data, data: addr=192.168.178.90,nfsvers=4: invalid argument

my docker-compose file:

version: "3.4"

volumes:
  data:
    driver_opts:
      type: nfs
      o: addr=nas-home,nfsvers=4
      device: /volume1/paperless/data
  media:
    driver_opts:
      type: nfs
      o: addr=nas-home,nfsvers=4
      device: /volume1/paperless/media
  consume:
    driver_opts:
      type: nfs
      o: addr=nas-home,nfsvers=4
      device: /volume1/paperless/consume
  export:
    driver_opts:
      type: nfs
      o: addr=192.168.178.90,nfsvers=4
      device: /volume1/paperless/export


services:
  broker:
    image: redis:6.0
    restart: unless-stopped

  webserver:
    image: jonaswinkler/paperless-ng:latest
    restart: unless-stopped
    depends_on:
      - broker
    ports:
      - 8000:8000
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000"]
      interval: 30s
      timeout: 10s
      retries: 5
    volumes:
      - data:/usr/src/paperless/data
      - media:/usr/src/paperless/media
      - export:/usr/src/paperless/export
      - consume:/usr/src/paperless/consume
    env_file: docker-compose.env
    environment:
      PAPERLESS_REDIS: redis://broker:6379
      PAPERLESS_CONSUMER_POLLING: 10

did anybody have an idea?

thanks ;)

1

There are 1 answers

0
Benoît On

Maybe it's a bit late, but in case of someone looks for an answer, you are missing a colon at the beginning of the device properties values.

Your configuration should looks like something like that:

volumes:
  data:
    driver_opts:
      type: "nfs"
      o: "addr=nas-home,nfsvers=4"
      device: ":/volume1/paperless/data"
...