title: Docker-compose and jenkinsfile with RoR
body: <p>I'm trying to mount a jenkins pipeline, with jenkinsfile and docker-compose. 
  My docker-compose run fine. But <strong>the next steps</strong> (test stage in Jenkinsfile) <strong>don't run</strong>. </p>
  
  <p>How to tell jenkins "<em>ok fine the docker container is fine, you can do the next thing</em>" but prevent the docker container to stop (this is why I put rails s at the end of the command"</p>
  
  <p>Here the <em>docker-compose.yml</em> :</p>
  
  <pre><code>version: '3'
  services:
    db-test:
      image: postgres
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_PASSWORD=secret
        - POSTGRES_DB=server_dev
      volumes:
        - ./tmp/db:/var/lib/postgresql/data
      ports:
        - "${POSTGRES_PORT}:5432"
    web-test:
      image: starefossen/ruby-node
      command: bash -c "cd /app &amp;&amp; bundle install &amp;&amp; rake db:migrate &amp;&amp; rails s"
      volumes:
        - /home/xero/jenkins/jenkins_home/workspace/project-open-source:/app   # Workspace
        - /home/cache/bundle:/usr/local/bundle                              # Cache gemfiles
        - /home/cache/node_modules:/app/node_modules                        # Cache yarn files
        - /home/xero/.ssh:/root/.ssh                                       # SSH keys (for git)
      ports:
        - "3000:3000"
      depends_on:
        - db-test
  </code></pre>
  
  <p>And the <em>Jenkinsfile</em> :</p>
  
  <pre><code>pipeline {
      agent any
      options {
          timeout(time: 1, unit: 'DAYS')
          disableConcurrentBuilds()
      }
      stages {
          stage("Init") {
              agent any
              steps { initialize() }
          }
          stage("Test") {
              agent any
               steps { test() }
          }
      }
  }
  
  def initialize() {
      sh 'docker-compose -f docker-compose-jenkins.yml up --build --abort-on-container-exit'
  }
  
  def test() {
      sh 'docker exec -ti web-test sh -c "cd app/ &amp;&amp; bundle exec rspec -f documentation"'
  }
  </code></pre>