title: Run python test inside docker and get the exit code outside on host machine
body: <p>I have this docker compose file </p>
  
  <pre><code>version: "2"
  services:
      abc_python_test:
          build: "python"
          container_name: "abc-python-test"
          volumes:
              - "../:/abc/"
          working_dir: "/abc"
          command: "sh -c 'python3 -m unittest tests/calculator.py'"
  </code></pre>
  
  <p>I have a following Makefile</p>
  
  <pre><code>test:
      cp config/config-$(env).cfg config/config.cfg
      docker-compose -f environment/test.yml up --build 
  </code></pre>
  
  <p>I run this <code>Makefile</code> in one of a build step we have in our CI.</p>
  
  <p>Problem is, the test run and fails, the <code>python3</code> process get the <code>exit code 1</code>. However, once the <code>python3</code> process get finished the container gets down. But my host machine shows the <code>status code 0</code>. This leads to get my build pass even the tests are failing.</p>
  
  <p>How can I forward this <code>python3</code> exit code to my main process so that it knows that the tests got failed.</p>
  
  <p>Thanks</p>
  
  <p>PS: We have old docker compose version that doesn't come with the <code>--exit-code-from</code> flag</p>