WindmillWWindmill
Powered by
badsequelB
Windmill•2y ago•
5 replies
badsequel

Delay in catching docker exit code in bash script

Toying around with scheduling a bash script that spins up a docker container to see if windmill would flag a job as failed if the container exited with 1.
Inside the container is a py script that craps out with a sys.exit(1) in about half runs.

Unless I set a "sleep" in the bash script windmill considers the run successful regardless of how the docker container exits. Anyone know why that is?

containerid=$(docker run -d crashing-container:v1.0 python main.py -r)
#sleep 1
exitcode=$(docker inspect --format='{{.State.ExitCode}}' $containerid)
echo "Container exit code: " $exitcode

if [ $exitcode -eq 0 ]; then
echo "Container {$containerid} ExitCode:{$exitcode} - Yay!"
exit 0 #unless sleep, bash script always exits through here...
else
echo "Container {$containerid} ExitCode:{$exitcode} - Fail!"
exit 1
fi
WindmillJoin
3,362Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?
Recent Announcements
henri-c

Weekly kenote to tell you about our latest updates https://discord.com/channels/930051556043276338/1278977038430240813 https://youtube.com/live/2dGd9TdT8xs?feature=share

henri-c · 4d ago

Pyra

### HTTP tracing (EE) Capture HTTP requests made by job scripts as observability spans Features: - View HTTP request traces (method, URL, status, timing) in the job details UI - Auto-instrumentation for Native TypeScript, MITM proxy for other languages - Integrates with external OpenTelemetry collectors changelog: https://www.windmill.dev/changelog/http-tracing docs: https://www.windmill.dev/docs/advanced/instance_settings#http-tracing Additionally jobs memory metrics are now fully OSS!

Pyra · 2w ago

henri-c

First keynote of the year here https://discord.com/channels/930051556043276338/1278977038430240813 🙂

henri-c · 4w ago

Similar Threads

Getting Empty Output from Bash Script
Trevor SullivanTTrevor Sullivan / help
3y ago
Set Windmill App State From Bash Script
Trevor SullivanTTrevor Sullivan / help
3y ago
Autogenerated Date input for Bash scripts
krisztian_fKkrisztian_f / help
2y ago
Can’t Use More Than 9 Positional Parameters in Bash Script Step?
장지수장장지수 / help
11mo ago