-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
docker stack deploy failed if volume name with special character like "@" used in the compose file #33529
Comments
@GordonTheTurtle, is there someone already looked into this issue? I can help to implement the fix. Can you point me someone who can shed some light on how to fix this issue? Thanks! |
This behavior is expected
Also, @GordonTheTurtle is a bot 🐢 |
@AkihiroSuda unfortunately it's not that simple; the However, I know that for Swarm-mode resources some additional restrictions apply (e.g. overlay networks with a I'm not sure if the same applies to volumes in swarm-mode, so will have to check. |
Yes, it looks like the yaml schema definition has a restriction on the volume name. |
@cpuguy83 Could you point me where is the yaml schema definition in the moby repo? I cannot find it. I can only find it in old docker repo https://github.com/docker/cli/blob/3d58c3feaccc71512e692f27c18c109d7b262281/cli/compose/schema/data/config_schema_v3.3.json#L33-L42 |
@lipingxue That is the correct place. The CLI lives in the docker/cli repo. |
@cpuguy83 So the fix should be done on the docker/cli repo, right? |
This one is fine.
Thanks!
…On Thu, Jun 8, 2017 at 1:58 PM, Liping Xue ***@***.***> wrote:
@cpuguy83 <https://github.com/cpuguy83> So the fix should be done on the
docker/cli repo, right?
Should I reopen the issue I filed with docker/compose(docker/compose#4886
<docker/compose#4886>) or use this issue when I
implement the fix? Thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#33529 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAwxZgLycpX-Gt3f0FpciFONuDI2R2Qiks5sCDZdgaJpZM4Nwmy5>
.
--
- Brian Goff
|
@cpuguy83 I have a question about this fix. After removing the restriction in the YAML file, https://github.com/docker/cli/blob/3d58c3feaccc71512e692f27c18c109d7b262281/cli/compose/schema/data/config_schema_v3.3.json#L33-L42, I also want to apply the check to make sure when user uses local driver to create volume in YAML file, the volume name can only be "[a-zA-Z0-9][a-zA-Z0-9_.-]". So I need to add check if the driver is local, and the volume name specified by user is not "[a-zA-Z0-9][a-zA-Z0-9_.-]", an error need to be returned. I mean some check like this
My question is where is the right place to put this check?
Who is the better person from docker/cli maintainer to contact for this issue? |
@lipingxue The YAML does not need to restrict names here, IMO. |
@dnephin I search the PR history in docker/cli repo, and it seems that you have worked on volume spec parse, which is may related to this issue that I plan to work on. So could you shed some lights on the fix of this issue? Thanks! |
The problem is that these names are internal references to volumes within the compose file, not just volume names. What's wrong with using an external volume? |
@dnephin Thanks for your quick response. Our customer wants to specify the volume name to be created in the YAML file and let the swarm service create the volume. AFAIK, |
@thaJeztah Could you shed some lights on this issue? I know using external volume in the compose file is a workaround, but it just a workaround. Other docker command such as |
Hm, so looking at the issue, the problem indeed seems to be that the In this case, the actual volume that's created would thus become So, possibly the This would look something like this; version: "3.2"
services:
web:
image: "nginx:alpine"
volumes:
- foo:/some/path
volumes:
foo:
name: mariadb@sharedVmfs-0
driver: vsphere
driver_opts:
size: 1Gb
diskformat: zeroedthick @dnephin do you think that would make sense? For now, there's actually a limitation/issue/bug that volumes defined as "external" are actually created if they do not exist when the stack is deployed (see the bug report here: #29976). So the following compose file actually creates a volume named version: "3.2"
services:
web:
image: "nginx:alpine"
volumes:
- foo:/some/path
volumes:
foo:
external:
name: i-am-external This may help you (for now), but may change in future so should not be relied on. |
@thaJeztah @dnephin Yes, I would like to have some way that users are able to specify a hard-coded volume, like the following.
Just want to confirm with you, the above YAML file does not work with the current
|
I also tried to make the change in compose schema json file.
After making the change to regex, I think compose should be able to parse volume name like "postgres_vol@vsanDatastore". But when I try
Why it complains "postgres_vol@vsanDatastore" is additonal property? Could you shed some lights? |
The format/parser currently doesn't expect a |
@thaJeztah Thanks for the quick response. Do you think the change I made is the right one, and I just need some way to "re-generated" after making the change in schema or the approach I take is totally wrong? What I need is to let user be able to specify volume name like "postgres_vol@vsanDatastore" in the YAML file and they can use this YAML file with |
The |
@thaJeztah Why Another question is say if I modify the schema file, how can I "re-generated" the variable which included in the Go source code? Do I need to use any specific tool to do that? |
If I recall correctly; in the docker/cli repository, run;
|
+1 for the suggestion from @thaJeztah to move To re-generate the schema:
|
Thanks. I created docker/cli#274 to add support for a custom name for non-external volumes. |
Description
I am trying to use vSphere Docker Volume Service with "docker stack deploy" command to deploy a stack with the following compose file.
In that compose file, the volume is created by
vSphere Docker Volume Service
, and has the format like vol_name@datastore (mariadb@sharedVmfs-0
in the compose file).docker stack deploy
failed with error like:"mariadb@sharedVmfs-0 Additional property mariadb@sharedVmfs-0 is not allowed".
Steps to reproduce the issue:
docker stack deploy -c docker-compose-vsphere.yml wordpress
in the master node to deploy the stackDescribe the results you received:
It looks to me that volume name including special characters like "@" cannot be used in the compose file.
Describe the results you expected:
I expect
docker stack deploy
works when the name of volume includes special character like "@".I know one of the workaround is to pre-create the volume
mariadb@sharedVmfs-0
, and then mark the volume as "external" in the compose file like this:It seems that most docker API can support volume name with special characters for volumes created by volume plugin, for example, I can create the volume
mariadb@sharedVmfs-0 -
using the volume plugin:So I think
docker stack deploy
should also work with volume name which includes special character like "@".Additional information you deem important (e.g. issue happens only occasionally):
Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.):
Ubuntu VMs running on ESX
The text was updated successfully, but these errors were encountered: