title: docker-compose: max depth exceeded
body: <p>I was using docker-compose, but when I tried to build it again, this error shows, I have build this docker-compose multiple times:</p>
  
  <pre><code>ERROR: Service 'api' failed to build: max depth exceeded
  </code></pre>
  
  <p>I tried to execute docker system prune to clean my containers, but it didn't work.</p>
  
  <p>docker-compose.yml</p>
  
  <pre><code>version: "3"
  services:
      client:
          container_name: my_client
          image: mhart/alpine-node:12
          build: ./client      
          restart: always
          ports:
              - "3000:3000"
          working_dir: /client
          volumes:
              - ./client:/client
          entrypoint: ["npm", "start"]
          links:
              - api
          networks: 
              - my_network
      api:
          container_name: my_api
          build: ./api
          restart: always
          ports:
              - "9000:9000"
          environment:
              DB_HOSTNAME: mysql    
          working_dir: /api
          volumes:
              - ./api:/api
          depends_on: 
              - mysql
          networks:
              - my_network
      mysql:
          container_name: my_mysql
          build: ./db
          restart: always
          volumes:
              - /var/lib/mysql
              - ./db:/db
          ports:
              - "3307:3306"
          environment:
              - MYSQL_ROOT_PASSWORD=n 
              - MYSQL_USER=n
              - MYSQL_PASSWORD=n
              - MYSQL_DATABASE=n
          networks: 
              - my_network
          command: '--default-authentication-plugin=mysql_native_password'
  networks:
      my_network:
          driver: bridge
  </code></pre>
  
  <p>this is the Dockerfile:</p>
  
  <pre><code>FROM mhart/alpine-node:12
  WORKDIR /api
  COPY package*.json /api/
  RUN npm i -G nodemon
  RUN npm install
  COPY . /api/
  EXPOSE 9000
  CMD ["npm", "run", "dev"]
  </code></pre>
  
  <p>any help is appreciated.</p>