In docker containers, volumes could be mounted as a file or a path. Docker volumes could be even shared among containers, and provides same experience upon different backends.
Volumes on Local Path
Docker has a
bind mounts feature that allows local path mounted in a container. It could be simply set by
docker run -v, but it also could be set with volume name. In
docker-compose.yml it would be like:
.... volumes: dbdata: driver: local driver_opts: type: 'none' o: 'bind' device: '/srv/db-data' ....
Volumes on NFS
Docker could also create volume on NFS. In
volumes: vol: drive: local driver_opts: type: 'nfs' o: 'addr=192.168.1.1,rw' device: '/path/to/dir'
will mount the /path/to/dir in rw mode from 192.168.1.1 to volume