-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker STDOUT missing when using sinatra #1118
Comments
@singram I'm pretty sure this has to do with how IO is buffered in a docker container. If you add a |
Setting |
Thanks! That did the trick for me as well ( |
Just wanted to share my thanks as well! |
Set `$stdout.sync = true` in config/boot.rb, because Ruby buffers stdout by default, and this doesn't play well with Docker Compose (data written to stdout, e.g. via puts, may not be displayed on terminal). See: sinatra/sinatra#1118
Given the following simple example (app.rb) and nothing more
Executing this via
bundle exec ruby app.rb
Renders both the puts statement and the expected sinatra behavior.
However when the same code is executed within a Docker container with the same execution command only the Sinatra output is visible. The puts statement never gets rendered.
However if you comment everything but the 'puts' statement and execute it in docker the puts statement is rendered correctly. The difference in docker behavior seems to be dependent on whether sinatra is required or not.
I seem to be missing something simple here. Any ideas?
The text was updated successfully, but these errors were encountered: