Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

anki-code/docker-xonsh-wrapper

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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]

Related links

About

Wrap an app in docker container and catch the signals from docker using xonsh shell.

Topics

Resources

Stars

Watchers

Forks

Releases

Sponsor this project

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.