You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The --secret and --config flags accept both a "basic" and "advanced" (csv / option=value) syntax.
Docker fails to detect the "advanced" syntax if there is no comma in the options passed, and as a result, attempts to use option=value as name for the secret.
Create a service that uses the config, using the advanced ("csv" / "option=value") syntax
docker service create --name hello1 --config source=myconfig nginx:alpine
config not found: source=myconfig
Create a service that uses the secret, using the advanced ("csv" / "option=value") syntax
docker service create --name hello2 --secret source=mysecret nginx:alpine
secret not found: source=mysecret
Create a service that uses the config, using the "basic" syntax (just referencing the name)
docker service create --name hello3 --config myconfig nginx:alpine
08oc61ewfwbkxmasstkgv5yzw
overall progress: 1 out of 1 tasks
1/1: running [==================================================>]
verify: Service converged
Create a service that uses the config, using the "basic" syntax (just referencing the name)
docker service create --name hello4 --secret mysecret nginx:alpine
k0fki16c5anjsylywuc75xxy1
overall progress: 1 out of 1 tasks
1/1: running [==================================================>]
verify: Service converged
Describe the results you expected:
Both --secret mysecret and --secret source=mysecret should work
Secret (and config) names are restricted to [a-zA-Z0-9-_.], so --secret source=blabla should not be ambiguous
echo blabla | docker secret create source=blabla -
Error response from daemon: rpc error: code = InvalidArgument desc = invalid name, only 64 [a-zA-Z0-9-_.] characters allowed, and the start and end character must be [a-zA-Z0-9]
Proposed fix
In the "single value" case, check if the value contains a =, and if that's the case, don't return early
Fixesdocker#2058 allowing the use of the advanced source=x syntax for config and secret values when there is no comma.
Before this change the following would fail with config not found:
docker service create --name hello1 --config source=myconfig nginx:alpine
And the following would fail with secret not found:
docker service create --name hello2 --secret source=mysecret nginx:alpine
Signed-off-by: Nick Adcock <[email protected]>
zappy-shu
added a commit
to zappy-shu/cli
that referenced
this issue
Jan 7, 2020
Fixesdocker#2058 allowing the use of the advanced source=x syntax for config and secret values when there is no comma
Before this change the following would fail with config not found:
docker service create --name hello1 --config source=myconfig nginx:alpine
And the following would fail with secret not found:
docker service create --name hello2 --secret source=mysecret nginx:alpine
Signed-off-by: Nick Adcock <[email protected]>
zappy-shu
added a commit
to zappy-shu/cli
that referenced
this issue
Jan 7, 2020
Fixesdocker#2058 allowing the use of the advanced source=x syntax for config and secret values when there is no comma
Before this change the following would fail with config not found:
docker service create --name hello1 --config source=myconfig nginx:alpine
And the following would fail with secret not found:
docker service create --name hello2 --secret source=mysecret nginx:alpine
Signed-off-by: Nick Adcock <[email protected]>
Description
The
--secret
and--config
flags accept both a "basic" and "advanced" (csv / option=value) syntax.Docker fails to detect the "advanced" syntax if there is no comma in the options passed, and as a result, attempts to use
option=value
as name for the secret.Describe the results you received:
Create a config and a secret:
Create a service that uses the config, using the advanced ("csv" / "option=value") syntax
Create a service that uses the secret, using the advanced ("csv" / "option=value") syntax
Create a service that uses the config, using the "basic" syntax (just referencing the name)
docker service create --name hello3 --config myconfig nginx:alpine 08oc61ewfwbkxmasstkgv5yzw overall progress: 1 out of 1 tasks 1/1: running [==================================================>] verify: Service converged
Create a service that uses the config, using the "basic" syntax (just referencing the name)
docker service create --name hello4 --secret mysecret nginx:alpine k0fki16c5anjsylywuc75xxy1 overall progress: 1 out of 1 tasks 1/1: running [==================================================>] verify: Service converged
Describe the results you expected:
Both
--secret mysecret
and--secret source=mysecret
should workSecret (and config) names are restricted to
[a-zA-Z0-9-_.]
, so--secret source=blabla
should not be ambiguousProposed fix
In the "single value" case, check if the value contains a
=
, and if that's the case, don't return earlyParsing for secrets:
cli/opts/secret.go
Lines 34 to 40 in ae16187
Parsing for configs:
cli/opts/config.go
Lines 34 to 40 in ae16187
We should also check other flags that accept both "basic" and "advanced" syntax, to see if they have similar issues
Output of
docker version
:The text was updated successfully, but these errors were encountered: