-1

i need some help to mount volume just only file.

i have tested methods nfs with docker-netshare but it only works for folders.

my compose file with mount file, but does not work:

version: "3.7"

services:
  web:
    image: nginx
    ports:
      - 80:80
    volumes:
      - nginx.vol:/usr/share/nginx/html/index.html
    deploy:
      placement:
        constraints: [node.role == manager]

volumes:
  nginx.vol:
    driver: nfs
    driver_opts:
      share: 192.168.1.13:/nginx_web/index.html

when i run command to mount a file i got a error:

docker run -i -t --volume-driver=nfs -v 192.168.1.13/config/traefik.toml:/root/test.toml alpine /bin/sh
docker: Error response from daemon: error while mounting volume '': VolumeDriver.Mount: exit status 32

anyway tks for your help :)

1 Answers1

1
version: '3.6'

services:
  default:
    image: traefik:1.7.6
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    configs:
      - source: traefik_config
        target: /etc/traefik/traefik.toml
    networks:
      default:
        aliases:
          - test.app
          - www.test.app
          - pma.test.app
          - monitor.test.app
    deploy:
      placement:
        constraints: [node.role != manager]
    labels:
      traefik.enable: 'true'
      traefik.frontend.rule: 'Host: monitor.test.app'
      traefik.port: 8080

configs:
  traefik_config:
    file: ../config/traefik.toml

use config it worked for me tks all :)