Home >Operation and Maintenance >Docker >How to view docker logs

How to view docker logs

王林
王林Original
2020-05-19 13:54:045691browse

How to view docker logs

You can view docker logs by using the docker logs command.

Command format:

docker logs [OPTIONS] CONTAINER

Parameter description:

-f: Trace log output

--since: Display a certain All logs at the start time

-t: Display timestamp

--tail: Only list the latest N container logs

Specific example:

View the logs after the specified time, only display the last 100 lines:

$docker logs -f -t --since="2018-02-08" --tail=100 CONTAINER_ID

View the logs of the last 30 minutes:

$docker logs --since 30m CONTAINER_ID

View the logs after a certain time:

$docker logs -t --since="2018-02-08T13:23:37" CONTAINER_ID

View logs for a certain time period:

$docker logs -t --since="2018-02-08T13:23:37" --until "2018-02-09T12:23:37" CONTAINER_ID

Recommended tutorial: docker tutorial

The above is the detailed content of How to view docker logs. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn