Docker daemon.json

Docker daemon 启动的时候可以有很多的命令行选项,这些选项也可以写到一个配置文件中,默认位置: /etc/docker/daemon.json ,key、value都和命令行一一对应,基本一样,但就是有些key在daemon.json中是复数形式,如: insecure-registries、storage-opts

 

docker-1.12 中 dm.basesize 默认10G, docker-1.9.11中默认 100G

storage-opts相关配置: https://docs.docker.com/engine/reference/commandline/dockerd/#/storage-driver-options

dm.fs 容器文件系统类型,目前支持ext4和xfs, 默认xfs

dm.loopdatasize 修改配置后,重启生效,只能改大,不能改小

dm.basesize 每次启动daemon都参考,一旦设置,无法修改,除非把daemon数据都删除重来;如果已经创建了容器了,不管该容器是死了、还是活着的、还是已删除,dm.basesize 都不能修改

参考: https://github.com/docker/docker/blob/f7d48d74a3dd44171d5e9dbcf33ba6de40baa08a/docs/reference/commandline/dockerd.md#daemon-configuration-file

 

有一些docker配置选项可以在不重启daemon的时候修改并生效,直接kill -HUP PID_OF_DAEMON 就可以,这种配置不多:

The list of currently supported options that can be reconfigured is this:

  • debug: it changes the daemon to debug mode when set to true.
  • cluster-store: it reloads the discovery store with the new address.
  • cluster-store-opts: it uses the new options to reload the discovery store.
  • cluster-advertise: it modifies the address advertised after reloading.
  • labels: it replaces the daemon labels with a new set of labels.
  • live-restore: Enables keeping containers alive during daemon downtime.
  • max-concurrent-downloads: it updates the max concurrent downloads for each pull.
  • max-concurrent-uploads: it updates the max concurrent uploads for each push.
  • default-runtime: it updates the runtime to be used if not is specified at container creation. It defaults to “default” which is the runtime shipped with the official docker packages.
  • runtimes: it updates the list of available OCI runtimes that can be used to run containers

有些配置重启daemon都不能生效

参考: https://docs.docker.com/engine/reference/commandline/dockerd/#/configuration-reloading

留下评论

邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据