1、安装插件
docker plugin install elastic/elastic-logging-plugin:8.11.3
2、修改/etc/docker/daemon.json
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn","http://hub-mirror.c.163.com","https://docker.mirrors.ustc.edu.cn","https://registry.docker-cn.com"],
"exec-opts": ["native.cgroupdriver=systemd"],
#"log-driver": "json-file",
#"log-opts": {
# "max-size": "100m"
#},
"log-driver" : "elastic/elastic-logging-plugin:8.12.0",
"log-opts" : {
"hosts" : "https://127.0.0.1:9200"
#"user" : "myusername",
#"password" : "mypassword"
},
"storage-driver": "overlay2",
"storage-opts": [
"overlay2.override_kernel_check=true"
]
}
3、重启 docker
4、重建容器
5、查询数据