docs icon indicating copy to clipboard operation
docs copied to clipboard

daemon.json type mismatch: json-file driver opt `max-file` expects string, not integer

Open Leglaw opened this issue 8 years ago • 7 comments

File: config/containers/logging/json-file.md, CC @johndmulhausen

Under Options, row max-file, description states:

A positive integer.

This is a misrepresentation. If you use a positive integer in the daemon.json, the dockerd service will output the following error:

cannot unmarshal number into Go value of type string

Not sure if it is particular to this json-file configuration or of it common in common throughout the daemon.json configuration, but it should be stated somewhere that it expects a type of string of an integer.

Leglaw avatar Feb 21 '18 17:02 Leglaw

Looks like the docs are wrong. Looking at the source, the driver options are string=string.

The tests, also confirm that.

joaofnfernandes avatar Feb 21 '18 21:02 joaofnfernandes

The docs describe " A positive integer plus a modifier representing the unit of measure (k, m, or g)", which looks correct to me, although perhaps a bit difficult to grasp

thaJeztah avatar Feb 21 '18 21:02 thaJeztah

@thaJeztah it's the max-file option, not max-size. I was about to make the same mistake when writing my original reply 😂

joaofnfernandes avatar Feb 21 '18 21:02 joaofnfernandes

oh! you're right, exactly how I got there.

Hm, so, yes, thinking how this should be documented. The issue here is that the "logging-driver options" are a generic way to pass options to the driver, for which strings are used.

The intent was to describe that (on the comandline) a numeric value is expected (the shell doesn't really care about integers or strings that respect). Some extra examples for the daemon.json could be useful likely

thaJeztah avatar Feb 21 '18 23:02 thaJeztah

Sorry about the confusion in the title that I too got wrapped up in... m(_ _)m

Leglaw avatar Feb 22 '18 01:02 Leglaw

Closing this ticket due to its age, and the impending refactor. If you think this is in error, feel free to reopen. Thanks!

ghost avatar Jan 02 '19 18:01 ghost

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

/lifecycle locked

docker-robott avatar Mar 12 '23 03:03 docker-robott