使用docker compose将nfs挂载到容器

wj8zmpe1  于 12个月前  发布在  Docker
关注(0)|答案(1)|浏览(139)

有人知道如何使用docker compose将NFS挂载到docker容器吗?我每次运行'docker compose up'时都会收到相同的错误:

Error response from daemon: error while mounting volume '/var/lib/docker/volumes/test_data/_data': failed to mount local volume: mount /etc/hapee-2.2/certs:/var/lib/docker/volumes/test_data/_data, data: addr=10.15.50.27,nolock,soft: invalid argument

字符串
从NFS导出文件似乎设置正确。我也试过从文件路径中删除“/home/”。IP地址被编辑。

/etc/hapee-2.2/certs <ipaddressofpc>(rw,sync,no_subtree_check,no_root_squash)


我一直怀疑docker-compose.yml,但我不确定它会有什么问题

version: '3.7'

services:
  hapee:
    image: haproxy:2.2
    container_name: test
    restart: always
    ports:
      - "80:80"
      - "443:443"
      - "8888:8888"
    volumes:
      - data:/etc/hapee-2.2/certs
    logging:
      options:
         max-size: 100m
         max-file: "3"

volumes:
  data:
    driver_opts:
      type: "nfs"
      o: "addr=10.15.50.27,nolock,soft,ro"
      device: "/etc/hapee-2.2/certs"


或者,有人知道另一种使用Docker compose将SSL证书安装到HAProxy容器的方法吗?
谢谢你,谢谢

knpiaxh1

knpiaxh11#

下面是一个直接粘贴的工作示例副本:

volumes:
  barril-immich-upload:
    driver_opts:
      type: "nfs"
      o: "addr=10.0.0.10,nolock,soft,rw"
      device: ":/volume1/immich/upload"
  barril-immich:
    driver_opts:
      type: "nfs"
      o: "addr=10.0.0.10,nolock,soft,rw"
      device: ":/volume1/immich"

字符串
希望能帮上忙。

相关问题