title: Docker compose taking too long
body: <p>I have a lot of projects in one solution in visual studio 2019 in a micro service architecture with Docker. now i have a docker-compose.yml file. it seems to be taking too long to build even one image and by taking too long i mean like more than an hour.</p>
  
  <pre><code>services:
    nosql.data:
      image: mongo
  
    mongo1:
      image: mongo
      hostname: mongo1
      container_name: mongo1
      command: "--replSet rs0"
  
    mongo2:
      image: mongo
      hostname: mongo2
      container_name: mongo2
      command: "--replSet rs0"
  
    mongo3:
      image: mongo
      hostname: mongo3
      container_name: mongo3
      command: "--replSet rs0"
  
    mysql.data: 
      image: mysql:latest
      container_name: mysql.data
  
    rabbit:
      image: rabbitmq:management
      container_name: rabbit
  
    es01:
      image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0
      container_name: es01
      ulimits:
        memlock:
          soft: -1
          hard: -1
      volumes:
        - esdata01:/elasticsearch/data
  
    es02:
      image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0
      container_name: es02
      ulimits:
        memlock:
          soft: -1
          hard: -1
      volumes:
        - esdata02:/elasticsearch/data
  
    cnx.useraccessmanagement.api:
      image: ${REGISTRY:}/useraccessmanagement.api:${PLATFORM:-linux}-${TAG:-latest}
      build:
        context: .
        dockerfile: src/Services/Program2/Dockerfile 
      depends_on:
         - nosql.data
         - mysql.data
         - rabbit
  
    cnx.identity.api:
      image: ${REGISTRY:}/identity.api:${PLATFORM:-linux}-${TAG:-latest}
      build:
        context: .
        dockerfile: src/Services/Program1/Dockerfile
  
    cnx.apigateway:
      image: ${REGISTRY:}/apigateway:${PLATFORM:-linux}-${TAG:-latest}
      build:
        context: .
        dockerfile: src/ApiGateway/Dockerfile
      depends_on:
        - identity.api
        - nosql.data
        - mysql.data
        - rabbit 
  
  volumes:
    esdata01:
      driver: local
    esdata02:
      driver: local
  </code></pre>
  
  <p>the project file size is almost 1gb and in terms of the build context set in this docker compose file, does it matter when it comes to affecting the build time? if so, what could be done for this to be optimized?</p>