How to specify an iterator in the volume path when using docker-compose to scale up service?

牧云@^-^@ 提交于 2019-12-03 06:17:47

You should really NOT log to the filesystem, and use a specialized log management tool like graylog/logstash/splunk/... instead. Either configure your logging framework in Tomcat with a specific appender, or log to sysout and configure a logging driver in Docker to redirect your logs to the external destination.

This said, if you really want to go the filesystem way, simply use a regular unnamed volume, and then call docker inspect on your container to find the volume's path on the filesystem :

[...snip...]
"Mounts": [
    {
        "Type": "volume",
        "Name": "b8c...SomeHash...48d6e",
        "Source": "/var/lib/docker/volumes/b8c...SomeHash...48d6e/_data",
        "Destination": "/opt/tomcat/logs",
[...snip...]

If you want to have nice-looking names in a specific location, use a script to create symlinks.

Yet, I'm still doubtfull on this solution, especially in a multi-host swarm context. Logging to an external, specialized service is the way to go in your use case.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!