Docker post installation configuration

I would like suggest add to the documentation docker post installation steps:

limit docker log files and add retention:

"log-driver": "json-file",
"log-opts": {
    "max-size": "100m",
    "max-file": "3"
    }

and change default shutdown timeout parameter:
"shutdown-timeout": 300

I tested both parameters on my node, and evrything is working fine.
If you will reboot host machine, no need to stop container before with docker stop storagenode -t 300 command, now daemon will handle it easy with new default parameter 300s.
Here is compleate settings for /etc/docker/daemon.json

{
"shutdown-timeout": 300,
"log-driver": "json-file",
"log-opts": {
    "max-size": "100m",
    "max-file": "3"
    }
}
5 Likes

to confirm, this requires a new-file? It does not exist by default? And i assume it requires a docker service restart before taking effect?

I think the

"log-driver": "json-file",

line might be redundant as that is the default log driver for docker.

Also, the log-opts parameters can be passed via the docker run command:

docker run -d --restart unless-stopped -p 28967:28967 \
--log-opt max-size=50m --log-opt max-file=10 \
...etc

(for example)
This way the other containers on the system (if any) will not be affected by those options.

3 Likes

This would require the creation of a daemon.json file in the appropriate location per OS as outlined here:


I believe this would require the docker service be restarted to take effect.

1 Like

Yes, it require restart docker daemon
service docker restart
If this file does not exist, you can create it.

Thanks! @baker
For logs, it is also true way if you would like specify parameters for each container.
My way is changing default parameters for docker daemon for all containers (I assume only storagenode and watchtower is persist on host)

There may be some flaw with intent; See conflicts with default container settings vs daemon:

can be either the value set on the daemon ( --shutdown-timeout ), or set by a container ( --stop-timeout ). After all containers are terminated, the daemon shuts down;

Ref:
discussion: https://github.com/moby/moby/issues/32357
https://docs.docker.com/v17.09/release-notes/docker-engine/
https://docs.docker.com/engine/reference/commandline/dockerd/

Thanks for pay attention!

But this information is out of date, two years is gone :slightly_smiling_face:

today we have:

Client: Docker Engine - Community
 Version:           19.03.0
 API version:       1.40
 Go version:        go1.12.5
 Git commit:        aeac9490dc
 Built:             Wed Jul 17 18:14:03 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.0
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.5
  Git commit:       aeac9490dc
  Built:            Wed Jul 17 18:12:33 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.6
  GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc:
  Version:          1.0.0-rc8
  GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
1 Like

Also I not reccomend add --stop-timeout to the docker run .... command, it will have issue with storjlabs/watchtower container.

4 posts were split to a new topic: Unauthenticated desc = serial number is already used: infodb: database is locked

For some reason I don’t have /docker under /etc/
So no daemon.json file either.

I wonder where this is located on Synology NAS, docker ver17.

It’s: /volume1/@appstore/Docker/config/dockerd.json

But I definitely expect changing the log driver will at least break log functionality in the GUI… if not more.
Change at your own risk.

1 Like

Thanks, I may just add/change docker shutdown time to 300 from default 10.
Yes, I don’t want to break UI docker logs. But I’ve noticed whenever the docker container is stopped and started the logs disappear and are not retained.

I like the ability to see UI docker logs but also want to retain a persistent copy. Hmmm