title: two docker-compose .yml in the same network with COMPOSE_PROJECT_NAME
body: <p>I am trying to have my own network name for my docker-compose files (server.yml and test.yml), as test.yml gets only started from time to time, but needs access to some services in the server.yml. I can make it work with <code>docker-compose -p nameofproject up</code>, but not with COMPOSE_PROJECT_NAME.</p>
  
  <p>server.yml</p>
  
  <pre><code>version: '2'
  
  networks:
    mynetwork:
      driver: bridge
  
  services:
    app1:
      networks:
        - mynetwork
      environment:
        POSTGRES_PASSWORD: somepassword
        COMPOSE_PROJECT_NAME: serverstack
  
    app2:
      networks:
        - mynetwork
      environment:
        COMPOSE_PROJECT_NAME: serverstack
      depends_on:
        - app1
  </code></pre>
  
  <p>My expectation is that when the container is starting I should see</p>
  
  <pre><code>Creating serverstackmynetwork_app_1
  Creating serverstackmynetwork_app_2
  </code></pre>
  
  <p>the network should be named (<code>docker network ls</code>) </p>
  
  <pre><code>serverstack_mynetwork
  </code></pre>
  
  <p>just like when I do the following, which actually works</p>
  
  <pre><code>docker-compose -p serverstack up
  </code></pre>
  
  <p>And then I can connect just by using <code>docker-compose up</code> with the second file (which works just fine when using the -p option on the server.yml)</p>
  
  <p>testing.yml</p>
  
  <pre><code>version: '2'
  
  networks:
    testapp_network:
      external:
        name: serverstack_mynetwork
  
  services:
    testapp:
      networks:
        - testapp_network
  </code></pre>
  
  <p>But using it without <code>-p serverstack</code> on the server.yml I see directories as names</p>
  
  <pre><code>Creating directoryofapp1_app1_1
  Creating directoryofapp2_app2_1
  </code></pre>
  
  <p>so <code>COMPOSE_PROJECT_NAME</code> is being omitted and I also cannot connect to the server service though serverstack_mynetwork</p>
  
  <p>I did add the <code>COMPOSE_PROJECT_NAME: serverstack</code> after building the image, but I would expect it should work anyhow. What am I missing?</p>