Reputation: 6817
i have a rails project which i start with
docker-compose up
however each time i start it, docker-compose outputs logs for all previous containers, and its increasingly more and more...
how do i limit the output of logging on startup?
here's my docker-compose.yml, it it helps...
web:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
environment:
RAILS_ENV: development
volumes:
- .:/rcd
ports:
- "3000:3000"
external_links:
- postgres:db
volumes_from:
- bundle
bundle:
image: rcd_web
command: echo "hi"
volumes:
- /bundle
and here's Dockerfile:
FROM ruby:2.1
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
ENV APP_HOME /rcd
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
ADD Gemfile* $APP_HOME/
ENV BUNDLE_GEMFILE=$APP_HOME/Gemfile \
BUNDLE_JOBS=2 \
BUNDLE_PATH=/bundle
RUN bundle install --without production development test
ADD . $APP_HOME
ENV PATH ~/bin:$PATH
i can of course remove all old containers with:
docker rm `docker ps -aq`
but i dont want to do it on each startup..
here's f.ex. logging after three stop/start
~/workspace/rcd$ docker-compose up
Starting rcd_bundle_1...
Starting rcd_web_1...
Attaching to rcd_bundle_1, rcd_web_1
bundle_1 | hi
bundle_1 | hi
bundle_1 | hi
web_1 | => Booting WEBrick
web_1 | => Rails 4.2.4 application starting in development on http://0.0.0.0:3000
web_1 | => Run `rails server -h` for more startup options
web_1 | => Ctrl-C to shutdown server
web_1 | Exiting
web_1 | [2015-11-17 11:52:16] INFO WEBrick 1.3.1
web_1 | [2015-11-17 11:52:16] INFO ruby 2.1.7 (2015-08-18) [x86_64-linux]
web_1 | [2015-11-17 11:52:16] INFO WEBrick::HTTPServer#start: pid=1 port=3000
web_1 | [2015-11-17 11:52:16] FATAL SignalException: SIGTERM
web_1 | /usr/local/lib/ruby/2.1.0/webrick/server.rb:170:in `select'
web_1 | /usr/local/lib/ruby/2.1.0/webrick/server.rb:170:in `block in start'
web_1 | /usr/local/lib/ruby/2.1.0/webrick/server.rb:32:in `start'
web_1 | /usr/local/lib/ruby/2.1.0/webrick/server.rb:160:in `start'
web_1 | /bundle/gems/rack-1.6.4/lib/rack/handler/webrick.rb:34:in `run'
web_1 | /bundle/gems/rack-1.6.4/lib/rack/server.rb:286:in `start'
web_1 | /bundle/gems/railties-4.2.4/lib/rails/commands/server.rb:80:in `start'
web_1 | /bundle/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:80:in `block in server'
web_1 | /bundle/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `tap'
web_1 | /bundle/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `server'
web_1 | /bundle/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
web_1 | /bundle/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
web_1 | bin/rails:8:in `require'
web_1 | bin/rails:8:in `<main>'
web_1 | [2015-11-17 11:52:16] INFO going to shutdown ...
web_1 | [2015-11-17 11:52:16] INFO WEBrick::HTTPServer#start done.
web_1 | => Booting WEBrick
web_1 | => Rails 4.2.4 application starting in development on http://0.0.0.0:3000
web_1 | => Run `rails server -h` for more startup options
web_1 | => Ctrl-C to shutdown server
web_1 | Exiting
web_1 | [2015-11-17 11:52:22] INFO WEBrick 1.3.1
web_1 | [2015-11-17 11:52:22] INFO ruby 2.1.7 (2015-08-18) [x86_64-linux]
web_1 | [2015-11-17 11:52:22] INFO WEBrick::HTTPServer#start: pid=1 port=3000
Upvotes: 1
Views: 527
Reputation: 28060
I think this issue was fixed in docker-compose 1.5. You'll only get logs from the time to start the container.
Upvotes: 2