You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docker-xonsh-wrapper shows the way to wrap an app (e.g. server) in docker container using xonsh shell to:
catching the signals from docker (SIGTERM, SIGINT, SIGHUP)
doing work before starting the app
doing work after stopping the app
To achieve this install xonsh in the container and use run.xsh as an entrypoint.
If you like the idea of xxh click ⭐ on the repo and stay tuned.
Build and run the demo container
git clone https://github.com/anki-code/docker-xonsh-wrapper
cd xonsh-docker-wrapper
docker build . -t local/docker-xonsh-wrapper
docker run --rm -it local/docker-xonsh-wrapper
Example
docker run --rm -it local/docker-xonsh-wrapper
# [Work before running the app]# The app just sleep 2 minutes zZzZzZz...## # Run docker stop, docker restart or press Ctrl+C## CATCH: signum=15, stopping the process... ## # After getting closing signal the app could take time # # to stopping (closing the database, clean the memory) # # and we're waiting the ending before doing final work.## [Work after running the app or getting stop signals]