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
Solution 1:
Please read docker logs --help
for help. Try below, starting from the last 10 lines. More details here.
docker logs -f --tail 10 container_name
Solution 2:
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
Solution 3:
use the --tail switch:
> docker logs -f <container name> --tail 10
this will show the log starting from the last 10 lines onwards