Where does the docked dock store its logs?

I pack the project into a docker sticking image, and I'm trying to access magazines, but no magazines.

Dockerfile

FROM jetty:9.2.10 MAINTAINER Me " me@me.com " ADD ./target/abc-1.0.0 /var/lib/jetty/webapps/ROOT EXPOSE 8080 

Bash script to start the docker image:

 docker pull me/abc docker stop abc docker rm abc docker run --name='abc' -d -p 10908:8080 -v /var/log/abc:/var/log/jetty me/abc:latest 

The image works, but I do not see any berth logs in /var/log .

I tried docker run -it jetty bash but did not see any berth logs in /var/log .

Am I missing a parameter for creating output logs, or does it display it somewhere other than /var/log/jetty ?

+5
source share
1 answer

Why don't you see the magazines

2 notes:

  • Running docker run -it jetty bash will start a new container instead of connecting you to an existing demonized container.

  • And it will refer to bash instead of launching the berth in this container, so it will not help you get the logs from any container.

Thus, this interactive container will not help you in any case.

But also...

JettyLogs are disabled anyway

Also, you won’t see the logs at the standard location (say, if you tried to use docker exec to read the logs or to get them in the volume), simply because the Jetty Docker file completely turned off logging.

If you look at jetty: 9.2.10 Dockerfile , you will see this line:

 && sed -i '/jetty-logging/d' etc/jetty.conf \ 

Which nicely removes the entire line that references the default jetty-logging.xml logging configuration.

What to do?

Reading logs with docker logs

Docker gives you access to standard container pins.

After that:

 docker run --name='abc' -d -p 10908:8080 -v /var/log/abc:/var/log/jetty me/abc:latest 

You can simply do this:

 docker logs abc 

And welcome something like this:

 Running Jetty: 2015-05-15 13:33:00.729:INFO::main: Logging initialized @2295ms 2015-05-15 13:33:02.035:INFO:oejs.SetUIDListener:main: Setting umask=02 2015-05-15 13:33:02.102:INFO:oejs.SetUIDListener:main: Opened ServerConnector@73ec519 {HTTP/1.1}{0.0.0.0:8080} 2015-05-15 13:33:02.102:INFO:oejs.SetUIDListener:main: Setting GID=999 2015-05-15 13:33:02.106:INFO:oejs.SetUIDListener:main: Setting UID=999 2015-05-15 13:33:02.133:INFO:oejs.Server:main: jetty-9.2.10.v20150310 2015-05-15 13:33:02.170:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/var/lib/jetty/webapps/] at interval 1 2015-05-15 13:33:02.218:INFO:oejs.ServerConnector:main: Started ServerConnector@73ec519 {HTTP/1.1}{0.0.0.0:8080} 2015-05-15 13:33:02.219:INFO:oejs.Server:main: Started @3785ms 

Use docker help logs for more details.

Customization

Obviously, your other option is to either return what the Dockerfile does by default for the jetty, or create your own docked Jetty.

+7
source

All Articles