Use a logging driver plugin预计阅读时间: 1 分钟
Docker logging plugins allow you to extend and customize Docker’s logging capabilities beyond those of the built-in logging drivers. A logging service provider can implement their own plugins and make them available on Docker Hub, Docker Store, or a private registry. This topic shows how a user of that logging service can configure Docker to use the plugin.
Install the logging driver plugin
To install a logging driver plugin, use
docker plugin install <org/image>,
using the information provided by the plugin developer.
You can list all installed plugins using
docker plugin ls, and you can inspect
a specific plugin using
Configure the plugin as the default logging driver
After the plugin is installed, you can configure the Docker daemon to use it as
the default by setting the plugin’s name as the value of the
key in the
daemon.json, as detailed in the
logging overview. If the
logging driver supports additional options, you can set those as the values of
log-opts array in the same file.
Configure a container to use the plugin as the logging driver
After the plugin is installed, you can configure a container to use the plugin
as its logging driver by specifying the
--log-driver flag to
docker run, as
detailed in the
If the logging driver supports additional options, you an specify them using
one or more
--log-opt flags with the option name as the key and the option
value as the value.