Docker Community Forums

Share and learn in the Docker community.

Docker compose : Mount CIFS directly

Hello,
I would like to add a CIFS type volume in my container.

I would like to put the share directly in the docker compose and avoid having to create a volume from the command line.

Exemple:
- Volum Name: Data
- Share: //192.168.1.10/Data
- Mountpath: /mnt/Share
- Username: ABCD
- Password: EFGH
- CIFS (version 2.0)

docker volume create
–driver local
–opt type=cifs
–opt device=//192.168.1.10/Data
–opt o=username=ABCD,password=EFGH,vers=2.0
–name Data

Forum search for “volume cifs” and sort by latest brought up this result:

Be aware that declared volumes are immutable once created. If you change settings of a volume, you will need to delete it from the cli, in order to let docker-compose create it with the new configuration.