1

We have Docker version 20.10.21, build baeda1f. It is running fine without logging options in docker-compose.yml but when we specify the logging options and then start docker-compose, it throws an error "ERROR: for Cannot create container for service : json: cannot unmarshal number into Go struct field LogConfig.HostConfig.LogConfig.Config of type string"

This is the entry in docker-compose.yml under that service -

logging:
        driver: "json-file"
        options:
            max-file: 5
            max-size: 10m

Please let me know what might be wrong with our configuration. Appreciate your help.

Krishnan V S
  • 1,124
  • 1
  • 13
  • 31

1 Answers1

4

Turned out that I had to specify max-file as string. It was already asked by someone 4 years ago, who found the answer himself. Docker: b'json: cannot unmarshal number into Go struct field LogConfig.Config of type string'

logging:
        driver: "json-file"
        options:
            max-file: "5"
            max-size: 10m

Hope it helps someone.

Krishnan V S
  • 1,124
  • 1
  • 13
  • 31