Hi All, i’m try to create a docker-compose file that mount external volumes with samba. I have searched more documents through google but, unfortunately, i don’t have find none.
In particular when i specify params, during execution i receive error:
Error response from daemon: error while mounting volume '/var/lib/docker/volumes/formazionephp7_cifs_mount/_data': failed to mount local volume: mount //server.name/dir:/var/lib/docker/volumes/formazionephp7_cifs_mount/_data, flags: 0x1, data: username=xxxx,password=yyyy: invalid argument
You shared a configuration that looks like my configuration, except mine has additional optional parameters. Mine worked like this when I was still using cifs shares.
A problem can be anything until you find out what it is. Error messages can be misleading and one issue can cause an other.
Not to mention that @meyay also added a version number which is indeed can be important depending on what your server version is. Imagine that the server has an older version which didn’t support an argument so you get “invalid argument”. Or for some reason without uid and gid the client doesn’t have permission to use an argument (okay, I didn’t have better example and it was a bad example, but I hope you got the idea.)
One more thing can be important. Your operating system and Docker installation. Does your Docker run on a Linux host directly or in Docker Desktop (for Windows, for Linux, for macOS)?
I have never tried cifs in Docker Desktop and I may be wrong, but if the virtual machine of Docker Desktop doesn’t have cifs utils, you probably can’t mount cifs filesystem.
A volume needs to be defined in the top level volumes section, regardless whether it is created within the compose file or refers to an external (=not managed by this compose file) volume.
You compose file from the first post would change to something like this;
Right, I missed that part when I looked it up in the compose specification the other day. volume.external.name indeed is marked as deprecated, and the warning you get confirms it.
You declared the volume with the name data. As such the volume needs to be addressed with its name data and not the external name.
volumes:
- data:/var/www/example
The compose file I shared yesterday should have worked as well. It just raised a deprecation warning, which does not prevent the configuration to work. Though, when at one point it gets finally removed from docker compose, this would have been an error that stops the compose project from starting.
Ok @meyay , you are very very Kind and i’m an idiot (i need to read the documentation better). @rimelek I’m sorry because, actually, the problem, apparently, is in the connection or in the username/password but the error is always “wrong parameters”.
I have create, in another server, a new samba connection and now function with this configuration:
One more thing: volumes once created are immutable. Any change in the compose file afterwards will not apply, unless the volume is manually removed and docker compose re-creates it with the new settings.
un’altra cosa per il futuro: nella mia prima versione ho inserito //server.name ma, sfortunatamente, sembra accettare solo ip //192.168.1.22 (per esempio).
Since you could write your previous posts in English, I guess you accidentally replied in your native language so I translated it for you Please, always try to write in English so everyone can understand it without translating and search for the post.