Specify max json log file size in docker

I am trying to specify the maximum file size for json-filein docker-compose.yml, for example,

log-opt:
  max-size=50m

but when I tried docker-compose up, he gave me an error,

ERROR: In file './docker-compose.yml', service 'log-opt' must be a mapping not a string.

How to fix it?

ps. I usedocker 1.11.2

+4
source share
1 answer

Your yaml syntax is not entirely correct. The docs say this should optionsnot be log-opt( https://docs.docker.com/compose/compose-file/#/logging ). Try it?

logging:
  driver: json-file
  options:
    max-size: 50m

Also, the error tells you that you may not have it in the right place in your jaml file. It would be necessary to make sure there is more context.

+7
source

Source: https://habr.com/ru/post/1652038/


All Articles