-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
daemon.json parsing ignores unknown fields #32530
Comments
I tried to investigate this issue but a few things are not clear for me.
This only seems to be the case if default-ulimit is an empty map (JSON Object). That means
This has been worked around, otherwise the error message In Matt3o12/moby@4b7d86e I added a fix to the config parser so that
Having said all that, I do not understand what config.configValuesSet() is supposed to accomplish. It deflattens the configuration map, except for certain values as defined in config.flatOptions What this means is that This also has the nasty side effect because
Instead of:
|
@dsheets
Does it means that if "default-ulimits" mistyped then docker start and notify "default-ulimits" replaced to "default-ulimit"? |
Also see the discussion on #34093 (comment) |
Would the recent addition of |
(standard) json does not support comments. the usual workaround is to add a key that is not used by the application such as |
Description
Unknown fields in
daemon.json
are ignored bydockerd
. At the least, I would expect a warning to be logged about use of unknown fields. The combination of ignored unknown fields and command line flags that differ from configuration fields is very user unfriendly. In the case of #32528,"default-ulimit": {}
(cf.--default-ulimit
) is accepted but"default-ulimits": {}
is rejected which is very confusing. Additionally, the behavior of #32528 (the following directives don't match any configuration option: default-ulimits
) implies that unknown fields should halt daemon start.I've been told that unknown fields are ignored as this reflects the behavior of the golang json unmarshaller. This behavior seems unsuitable for a configuration file format with a fixed specification. Perhaps a different JSON parsing solution needs to be used?
Possible solutions include:
daemon.json
).Steps to reproduce the issue:
{ "jjj": {}, "default-ulimit": {} }
indaemon.json
dockerd
Describe the results you received:
No failure occurred nor message logged that unknown fields were used in configuration.
Describe the results you expected:
dockerd
should not start and the log file should contain an explanation.Additional information you deem important (e.g. issue happens only occasionally):
N/A
Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.):
N/A
The text was updated successfully, but these errors were encountered: