Docker Community Forums

Share and learn in the Docker community.

How can script exit docker logs -f <Container name>

I am running a container through a script and have the command "docker logs -f
The script runs and the logs appear. I am in a running shell and I have to use ctrl + c to exit it, How can I edit the script so after the logs are displayed the shell exits. I only need a 70 seconds timespan log.

I have put the script to sleep for 70seconds and used "docker logs but I don’t like this approach as I have to scroll up to check for warnings and errors.

Any advice?