Docker add network drive as volume on windows

前端 未结 2 977
情话喂你
情话喂你 2020-12-03 03:55

I am trying to mount a network drive as a volume. This is the command I am trying

docker run -v //NetworkDirectory/Folder:/data alpine ls /data
相关标签:
2条回答
  • 2020-12-03 04:26

    My colleague came up with this and it works with our company network drive and it might help someone out there.

    We start by creating a docker volume named mydockervolume.

    docker volume create --driver local --opt type=cifs --opt device=//networkdrive-ip/Folder --opt o=user=yourusername,domain=yourdomain,password=yourpassword mydockervolume
    
    • --driver specifies the volume driver name
    • --opt Sets driver specific options. I guess they are given to the linux mount command when the container starts up.

    We can then test that the volume works with
    docker run -v mydockervolume:/data alpine ls /data

    Here you can read more about driver specific options and docker volume create

    0 讨论(0)
  • 2020-12-03 04:34

    I didn't find a native CIFS storage driver on docker.

    You can use an external volume plugin like this one: https://github.com/ContainX/docker-volume-netshare which support NFS, AWS EFS & Samba/CIFS

    0 讨论(0)
提交回复
热议问题