jsondockerdocker-daemon

How do I add comments to dockerd daemon.json?


I checked documentation https://docs.docker.com/config/daemon/ and researched the net, but found no answer. How to add comments to deamon.json in docker daemon?


Solution

  • Actually you could not because it is a JSON file, which does not accept any kind of comment syntax.

    Neither adding a dummy extra JSON field, name for example comments, works, beacause it causes a daemon startup failure (I tried it before writing this answer).

    Here you can find a complete description of this issue. The article tells about the Microsoft JSONC (JSON with Comments) format.

    A simple and stupid workaround maybe a README file to describe the settings placed into /etc/docker.