title: Docker compose orphan containers when overriding services
body: <p>I want to have two docker-compose files, where one overrides another.<br>
  <em>(The motivation comes from <a href="https://docs.docker.com/compose/extends/#/multiple-compose-files" rel="noreferrer">Docker Compose Docs</a>)</em><br>
  The use case comes from the buildbot environment. The first docker-compose file should define a simple service. This is a service that is going to be tested. Let's take</p>
  
  <pre><code>version: '2'
  services:
    service-node:
      build:
        context: ./res
        dockerfile: Dockerfile
      image: my/server
      env_file: .env
  </code></pre>
  
  <p>The second docker-compose file (let's name it <em>docker-compose.test.yml</em>) overrides the service-node to add a buildbot worker feature, and creates the second container, i.e. buildbot master node, that is going to control testing machinery. Let's take</p>
  
  <pre><code>version: '2'
  services:
    service-node:
      build:
        context: ./res
        dockerfile: buildbot.worker.Dockerfile
      image: my/buildbot-worker
      container_name: bb-worker
      env_file: ./res/buildbot.worker.env
      environment:
        - BB_RES_DIR=/var/lib/buildbot
      networks:
        testlab:
          aliases:
            - bb-worker
      volumes:
        - ./vol/bldbot/worker:/home/bldbotworker
      depends_on:
        - bb-master
  
    bb-master:
      build:
        context: ./res
        dockerfile: buildbot.master.Dockerfile
      image: my/buildbot-master
      container_name: bb-master
      env_file: ./res/buildbot.master.env
      environment:
        - BB_RES_DIR=/var/lib/buildbot
      networks:
        - testlab
      expose:
        - "9989"
      volumes:
        - ./vol/bldbot/master:/var/lib/buildbot
  
  networks:
    testlab:
      driver: bridge
  </code></pre>
  
  <p>Generally this configuration works, i.e. the command</p>
  
  <pre><code>docker-compose -f docker-compose.yml -f docker-compose.test.yml up -d 
  </code></pre>
  
  <p>builds both images and runs both containers, but there is one shortcoming, i.e. the command</p>
  
  <pre><code>docker-compose ps
  </code></pre>
  
  <p>shows only one service, bb-worker. At the same time</p>
  
  <pre><code>docker ps
  </code></pre>
  
  <p>shows both.<br>
  Furthermore, the command</p>
  
  <pre><code>docker-compose down
  </code></pre>
  
  <p>stops only one service, and outputs the message/warning <code>Found orphan containers</code>. Of course, the message refers to bb-master.</p>
  
  <p>How can I override the basic docker-compose.yml file to be able to add additional non-orphan service?</p>