title: creation of container using docker-compose deletes another container that is already running
body: <p>I am trying to start 2 separate containers using the <code>docker-compose</code> command based on 2 different images.  </p>
  
  <p>One image (work) is based on code worked on in "development". A second image (cons) image is created by code that is currently at the "consolidation" level.</p>
  
  <h1>When starting the first container, all seems to go OK.</h1>
  
  <p><a href="https://i.stack.imgur.com/dXg65.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dXg65.png" alt="enter image description here"></a></p>
  
  <p>Details of above image are here:</p>
  
  <p><strong>WORK DIRECTORY: ~/apps/django.work/extraction/docker-compose.yml</strong></p>
  
  <pre><code>version: '3'
  
  services:
    db:
      image: postgres
      container_name: postgres-work           
    web:
      build: .
      image: apostx-cc-backoffice-work        
      container_name: cc-backoffice-work      
      command: python3 backendworkproj/manage.py runserver 0.0.0.0:8000
      volumes:
        - .:/code
      ports:
        - "7350:8000"
      depends_on:
        - db
  </code></pre>
  
  <p><strong>EXECUTION:~/apps/django.work./extraction$ docker-compose up --no-deps -d web</strong></p>
  
  <pre><code>Creating network "extraction_default" with the default driver
  Creating cc-backoffice-work ...
  Creating cc-backoffice-work ... done
  </code></pre>
  
  <p><strong>EXECUTION:~/apps/django.work/extraction$ docker container ls</strong></p>
  
  <pre><code>CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS              PORTS                    NAMES
  39185f36941a        apostx-cc-backoffice-work   "python3 backendwo..."   8 seconds ago       Up 7 seconds        0.0.0.0:7350-&gt;8000/tcp   cc-backoffice-work
  dede5cb1966a        jarkt/docker-remote-api     "/bin/sh -c 'socat..."   2 days ago          Up 2 days           0.0.0.0:3080-&gt;2375/tcp   dock_user_display_remote
  </code></pre>
  
  <h1>But, when I work with the second directory to compile and start a different image, some strange things start to happen:</h1>
  
  <p><a href="https://i.stack.imgur.com/vuRLV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vuRLV.png" alt="enter image description here"></a></p>
  
  <p>Again, more details are below:</p>
  
  <p><strong>CONS DIRECTORY: ~/apps/django.cons/extraction/docker-compose.yml</strong></p>
  
  <pre><code>version: '3'
  
  services:
    db:
      image: postgres
      container_name: postgres-cons         
    web:
      build: .
      image: apostx-cc-backoffice-cons      
      container_name: cc-backoffice-cons    
      command: python3 backendworkproj/manage.py runserver 0.0.0.0:8000
      volumes:
        - .:/code
      ports:
        - "7450:8000"
      depends_on:
        - db
  </code></pre>
  
  <p><strong>EXECUTION:~/apps/django.cons/extraction$ docker-compose up --no-deps -d web</strong></p>
  
  <pre><code>Recreating cc-backoffice-work ...
  Recreating cc-backoffice-work
  Recreating cc-backoffice-work ... done
  </code></pre>
  
  <p><strong>EXECUTION:~/apps/django.cons/extraction$ docker container ls</strong></p>
  
  <pre><code>CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS              PORTS                    NAMES
  f942f84e567a        apostx-cc-backoffice-cons   "python3 backendwo..."   7 seconds ago       Up 6 seconds        0.0.0.0:7450-&gt;8000/tcp   cc-backoffice-cons
  dede5cb1966a        jarkt/docker-remote-api     "/bin/sh -c 'socat..."   2 days ago          Up 2 days           0.0.0.0:3080-&gt;2375/tcp   dock_user_display_remote
  </code></pre>
  
  <h1>Question</h1>
  
  <p>Why is the first container being supplanted when I start the second one? If it is due to some kind of caching issue, how can one re-initialize/clean/clear out the cache before running <code>docker-compose</code> for a second time? Am I missing something here?</p>
  
  <p>TIA</p>
  
  <h1>Update - I did the following:</h1>
  
  <blockquote>
    <ol>
    <li>got rid of old containers by using "docker container rm -f "</li>
    </ol>
  </blockquote>
  
  <p>-</p>
  
  <blockquote>
    <ol start="2">
    <li>started the "work" (i.e. development) container</li>
    </ol>
  </blockquote>
  
  <p><strong>execute:~/apps/django.work.ccbo.thecontractors.club/extraction$ docker-compose --verbose up --no-deps -d web >&amp; the_results_are_here</strong></p>
  
  <p><strong>execute:~/apps/django.work.ccbo.thecontractors.club/extraction$ docker container ls</strong></p>
  
  <pre><code>CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS              PORTS                    NAMES
  61d2e9ccbc28        apostx-cc-backoffice-work   "python3 backendwo..."   4 seconds ago       Up 4 seconds        0.0.0.0:7350-&gt;8000/tcp   work-cc-backoffice
  dede5cb1966a        jarkt/docker-remote-api     "/bin/sh -c 'socat..."   3 days ago          Up 3 days           0.0.0.0:3080-&gt;2375/tcp   dock_user_display_remote
  9b4b8b462fcb        wmaker-test-officework      "catalina.sh run"        11 days ago         Up 11 days          0.0.0.0:7700-&gt;8080/tcp   testBackOfficeWork.2017.10.30.04.20.01
  ad5fd0592a07        wmaker-locl-officework      "catalina.sh run"        11 days ago         Up 11 days          0.0.0.0:7500-&gt;8080/tcp   loclBackOfficeWork.2017.10.30.04.20.01
  7bc9d7f94828        wmaker-cons-officework      "catalina.sh run"        11 days ago         Up 11 days          0.0.0.0:7600-&gt;8080/tcp   consBackOfficeWork.2017.10.30.04.20.01
  </code></pre>
  
  <blockquote>
    <ol start="3">
    <li>seeing that it looks OK, started the container for "cons" (consolidation)</li>
    </ol>
  </blockquote>
  
  <p><strong>execute:~/apps/django.cons.ccbo.thecontractors.club/extraction$ docker-compose --verbose up --no-deps -d web >&amp; the_results_are_here</strong></p>
  
  <p><strong>execute:~/apps/django.cons.ccbo.thecontractors.club/extraction$ docker container ls</strong></p>
  
  <pre><code>CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS              PORTS                    NAMES
  0fb24fc45877        apostx-cc-backoffice-cons   "python backendwor..."   5 seconds ago       Up 4 seconds        0.0.0.0:7450-&gt;8010/tcp   cons-cc-backoffices
  dede5cb1966a        jarkt/docker-remote-api     "/bin/sh -c 'socat..."   3 days ago          Up 3 days           0.0.0.0:3080-&gt;2375/tcp   dock_user_display_remote
  9b4b8b462fcb        wmaker-test-officework      "catalina.sh run"        11 days ago         Up 11 days          0.0.0.0:7700-&gt;8080/tcp   testBackOfficeWork.2017.10.30.04.20.01
  ad5fd0592a07        wmaker-locl-officework      "catalina.sh run"        11 days ago         Up 11 days          0.0.0.0:7500-&gt;8080/tcp   loclBackOfficeWork.2017.10.30.04.20.01
  7bc9d7f94828        wmaker-cons-officework      "catalina.sh run"        11 days ago         Up 11 days          0.0.0.0:7600-&gt;8080/tcp   consBackOfficeWork.2017.10.30.04.20.01
  </code></pre>
  
  <blockquote>
    <ol start="4">
    <li>Again, the name: work-cc-backoffice has been supplanted by name: cons-cc-backoffices  - work-cc-backoffice is totally gone now.</li>
    </ol>
  </blockquote>
  
  <p>-</p>
  
  <blockquote>
    <ol start="5">
    <li>Looked at the file the_results_are_here (in the second run) to see if anything can be found</li>
    </ol>
  </blockquote>
  
  <pre><code>[... snip ...]
  
  compose.cli.command.get_client: docker-compose version 1.17.1, build 6d101fb
  docker-py version: 2.5.1
  CPython version: 2.7.13
  OpenSSL version: OpenSSL 1.0.1t  3 May 2016
  compose.cli.command.get_client: Docker base_url: http+docker://localunixsocket
  compose.cli.command.get_client: Docker version: KernelVersion=4.4.0-72-generic, Arch=amd64, BuildTime=2017-09-26T22:40:56.000000000+00:00, ApiVersion=1.32, Version=17.09.0-ce, MinAPIVersion=1.12, GitCommit=afdb6d4, Os=linux, GoVersion=go1.8.3
  compose.cli.verbose_proxy.proxy_callable: docker info &lt;- ()
  compose.cli.verbose_proxy.proxy_callable: docker info -&gt; {u'Architecture': u'x86_64',
  
  [... snip ...]
  
  compose.cli.verbose_proxy.proxy_callable: docker inspect_network &lt;- (u'extraction_default')
  compose.cli.verbose_proxy.proxy_callable: docker inspect_network -&gt; {u'Attachable': True,
   u'ConfigFrom': {u'Network': u''},
   u'ConfigOnly': False,
   u'Containers': {u'61d2e9ccbc28bb2aba918dc24b5f19a3f68a06b9502ec1b98e83dd947d75d1be': {u'EndpointID': u'e19696ccf258a6cdcfcce41d91d5b3ebcb5fffbce4257e3480ced48a3d7dcc5c',
                                                                                         u'IPv4Address': u'172.20.0.2/16',
                                                                                         u'IPv6Address': u'',
                                                                                         u'MacAddress': u'02:42:ac:14:00:02',
                                                                                         u'Name': u'work-cc-backoffice'}},
   u'Created': u'2017-11-10T09:56:22.709914332Z',
  
   u'Driver': u'bridge',
  ...
  compose.cli.verbose_proxy.proxy_callable: docker containers &lt;- (all=False, filters={u'label': [u'com.docker.compose.project=extraction', u'com.docker.compose.oneoff=False']})
  compose.cli.verbose_proxy.proxy_callable: docker containers -&gt; (list with 1 items)
  compose.cli.verbose_proxy.proxy_callable: docker inspect_container &lt;- (u'61d2e9ccbc28bb2aba918dc24b5f19a3f68a06b9502ec1b98e83dd947d75d1be')
  compose.cli.verbose_proxy.proxy_callable: docker inspect_container -&gt; {u'AppArmorProfile': u'docker-default',
   u'Args': [u'backendworkproj/manage.py', u'runserver', u'0.0.0.0:8000'],
   u'Config': {u'AttachStderr': False,
               u'AttachStdin': False,
               u'AttachStdout': False,
               u'Cmd': [u'python3',
                        u'backendworkproj/manage.py',
                        u'runserver',
                        u'0.0.0.0:8000'],
               u'Domainname': u'',
  ...
  compose.cli.verbose_proxy.proxy_callable: docker containers &lt;- (all=True, filters={u'label': [u'com.docker.compose.project=extraction', u'com.docker.compose.service=web', u'com.docker.compose.oneoff=False']})
  compose.cli.verbose_proxy.proxy_callable: docker containers -&gt; (list with 1 items)
  compose.cli.verbose_proxy.proxy_callable: docker inspect_container &lt;- (u'61d2e9ccbc28bb2aba918dc24b5f19a3f68a06b9502ec1b98e83dd947d75d1be')
  compose.cli.verbose_proxy.proxy_callable: docker inspect_container -&gt; {u'AppArmorProfile': u'docker-default',
  </code></pre>
  
  <blockquote>
    <p>To me, it looks like the program is trying to do some initialization
    by looking for a container that is already up and running(?) See pic.
    below. How can one change this behavior</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/pNo5I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pNo5I.png" alt="enter image description here"></a></p>