title: Angular cant connect to spring boot endpoints in docker compose
body: <p>I moved my spring app (backend) and angular app (frontend) to docker compose - all looks works well, but when angular send GET/POST to spring boot gets no reponse.</p>
  
  <p>Dockerfile:</p>
  
  <pre><code>FROM java
  
  VOLUME /tmp
  
  ADD build/libs/backend.jar spring-boot-app.jar
  
  RUN bash -c 'touch /spring-boot-app.jar'
  
  ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/spring-boot-app.jar"]
  </code></pre>
  
  <p>docker-compose.yml</p>
  
  <pre><code>version: '3'
  
  
    backend:
      container_name: "backend"
      restart: always
      image: app:latest
      depends_on:
      - mysql
      - mongodb
      ports:
      - 8087:8080
  
    frontend:
      container_name: "frontend"
      image: frontend:latest
      ports:
      - 4201:4200
  </code></pre>
  
  <p>Dockerfile angular:</p>
  
  <pre><code>FROM node:9.6.1
  
  RUN mkdir /usr/src/app
  WORKDIR /usr/src/app
  
  ENV PATH /usr/src/app/node_modules/.bin:$PATH
  
  COPY package.json /usr/src/app/package.json
  RUN npm install
  RUN npm install -g @angular/cli@1.7.1
  
  COPY . /usr/src/app
  
  CMD ng serve --host 0.0.0.0 --prod
  </code></pre>
  
  <p>My api const:</p>
  
  <pre><code>export const environment = {
    production: true,
    apiUrl: "http://backend:8080"
  };
  </code></pre>
  
  <p>When I go to localhost:4201 - I can see my frontend, when I go to localhost:8087 I can see my backend and endpoints works well, but Angular doesnt get response:</p>
  
  <p><a href="https://i.stack.imgur.com/ex8uG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ex8uG.png" alt="enter image description here"></a></p>
  
  <p>For couple of time I'm trying to figure out - I will be grateful for every advice.</p>