1

By adding this command docker logs -f <container>, able to print the docker logs, but it is not exiting from this command after the server is running. I have other commands that have to be run after the docker run, but the logs command is not exiting. We can exit the terminal in local, but how can I exit this and run the remaining shell script in jenkins pipeline automatically. Also, tried docker logs -f --until=30s <container>, but this is not even printing the logs in jenkins pipeline.

Parkjin
  • 11
  • 4
  • 1
    Maybe I'm misunderstanding, but if you add `-f` , which stands for _follow_, docker will keep trying to show new logs (follow the log output) until the container is completed (terminated, if you may). Could you clarify why `docker logs ` (a 1-time shot showing of logs) is not suitable? – Savir Oct 24 '22 at 16:17
  • @BorrajaX So, when I'm using just the ```docker logs ```, it's not showing me the whole indepth logs - like server ready at..., etc. adding the follow option is helpful for this. Is there any other way I can terminate executing the ```docker logs -f ``` in the shell script itself? – Parkjin Oct 24 '22 at 16:27
  • Not that I know of. Maybe there is (I'm not super knowledgeable in Docker, to be honest) If it was me, I would maaaybe try to find a way to send a `kill -SIGINT` to the `docker logs -f` process. [Like shown here](https://stackoverflow.com/questions/5789642/how-to-send-controlc-from-a-bash-script). But that sounds like a terrible idea – Savir Oct 24 '22 at 16:33

0 Answers0