0

I'm trying to make a script to quickly test whether the network connection works inside docker using busybox.

All of these tests failed to timeout after 5 seconds (they took 30 seconds to timeout):

docker run busybox wget -T 5 google.com
docker run busybox timeout 5 wget google.com
timeout 5 docker run busybox wget google.com

The only thing that worked was to shell into busybox interactively. That did successfully terminate in 5 seconds. But I'm trying to do this programmatically, not interactively.

docker run -it busybox

/ # timeout 5 wget google.com
Terminated

Why did the timeout work in the interactive shell, but does not work non-interactively?

I'm running from an Ubuntu 18:04 VM.

1 Answer 1

0

This worked: using -s9 to send SIGKILL.

timeout -s9 5 docker run busybox wget google.com

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .