title: Docker, docker-compose, restart: unless-stopped loose logs in console
body: <p>I have a <code>docker-compose.yml</code> version 3 which works very good:</p>
  
  <pre><code>version: '3'
  
  services:
  
    db:
      image: postgres
      restart: unless-stopped
      ports:
        - "5432:5432"
  
  redis:
      image: redis
      restart: unless-stopped
      ports:
        - "6379:6379"
  
    app:
      build: .
      restart: unless-stopped
      command: bash ./script.sh
      volumes:
        - bundle:/bundle
      ports:
        - "3000:3000"
        - "1234:1234"
      depends_on:
        - db
        - redis
      stdin_open: true
      tty: true
  
  volumes:
  
    bundle: {}
  </code></pre>
  
  <p>I use it with Rails and I debug attaching from Windows port 1234. Everything works good.</p>
  
  <p>But.</p>
  
  <p>Sometimes my Rails server crash. It happens. So I need the <code>app</code> container restart itself. And it does. But I lose the logs in my powershell console.</p>
  
  <p>When starting with <code>docker-compose up</code> I see everything.</p>
  
  <p>When the <code>app</code> container crash and restart itself I don't see anything from the "new" <code>app</code> container. Why?</p>
  
  <p>If I close manually that <code>app</code> container and start it manually all logs from the before restarted container appears again scrolling down like the Niagara Falls!</p>
  
  <p>Bug? My own bug?</p>