Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--name option to name the volume is missing for cifs-volume-plugin #17

Open
christian-weiss opened this issue Jan 4, 2019 · 2 comments

Comments

@christian-weiss
Copy link

christian-weiss commented Jan 4, 2019

If i run:

docker volume create -d trajano/cifs-volume-plugin --opt cifsopts=uid=1000 192.168.8.4/Downloads

the a value with the name "192.168.8.4/Downloads" will be created (username, password and domain came from /root/credentials/default):

docker volume ls
DRIVER                              VOLUME NAME
trajano/cifs-volume-plugin:latest   192.168.8.4/Downloads

To show you that this is not an allowed name i delete this volume and then try to mount this non-existing volume (this prints out the allowed characters for volume names):

docker run -d --name helloshare -v 192.168.8.4/Downloads:/testvolumesmb strm/helloworld-http
docker: Error response from daemon: create 192.168.8.4/Downloads: "192.168.8.4/Downloads" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.
See 'docker run --help'.

means the "/" is not allowed. Would be nice if you generate a better volume name and add support for "--name" option to define a custom volume name.

@christian-weiss
Copy link
Author

docker version
Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        e68fc7a
 Built:             Tue Aug 21 17:25:03 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       e68fc7a
  Built:            Tue Aug 21 17:23:29 2018
  OS/Arch:          linux/amd64
  Experimental:     false

@trajano
Copy link
Owner

trajano commented Jan 4, 2019

What needs to happen is around

https://github.com/trajano/docker-volume-plugins/blob/master/cifs-volume-plugin/main.go#L29

shareName, shareNameInOpts := req.Options["share"]
if ! shareNameInOpts {
  shareName = "//" + req.Name
}

Then https://github.com/trajano/docker-volume-plugins/blob/master/cifs-volume-plugin/main.go#L43

return []string{"-t", "cifs", "-o", strings.Join(cifsoptsArray, ","), shareName}

Or something like that.

I'm free to take in a PR for this but needs to have the documentation updated as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants