Docker
Easy workaround for quirks you will encounter when running crystal in Docker.
What this will fix
- Unresponsiveness to
SIGINTandSIGTERMwhen running in Docker (Ctrl-cwill do nothing) - No output from your application to
STDOUTorSTDERR
Installation
-
Add the dependency to your
shard.yml:dependencies: docker: github: repomaa/docker.cr -
Run
shards install
Usage
In your application preferably before doing anything else:
require "docker"
Docker.setup
This will setup signal handlers for SIGINT and SIGTERM as well as setup
syncing for STDOUT and STDERR.
You can also do just one of those two things by calling either
Docker.setup_signal_handling or Docker.setup_io_syncing instead of
Docker.setup.
If you found this helpful, consider donating over liberapay!
Contributing
- Fork it (https://github.com/repomaa/docker.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Joakim Repomaa - creator and maintainer