How to tail a docker log from the current position in the log without seeing the whole file or waiting for it to traverse the whole file
I wonder why don’t use docker logs --help
for help? Try below, starting from the last 10 lines. More details here.
docker logs -f --tail 10 container_name
Alternatively, we can check the log by time (eg. since last 2mins) as:
docker logs --since=2m <container_id> // since last 2 minutes
docker logs --since=1h <container_id> // since last 1 hour
use the --tail switch:
> docker logs -f <container name> --tail 10
this will show the log starting from the last 10 lines onwards