How to serve Angular app via Nginx + docker-compose with proxy pass

I’m having some trouble to serve an Angular app within a docker-compose environment with Nginx.

The docker-compose.yml is

version: '3'
services:

  frontend:
    build: './frontend'
    ports:
      - "3001:8080"
  
  nginx:
    image: nginx:latest
    ports:
      - "8080:8080"
    volumes:
      - ./default.conf:/etc/nginx/conf.d/default.conf
    depends_on:
      - frontend

The Angular app is inside the ./frontend folder and there is a Dockerfile.

The default.conf

server {
  listen 8080;

  location / {
    proxy_pass http://frontend:3001;
  }

}

After build and run (with docker-compose build && docker-compose up) I’m able to access the Angular app through the url http://localhost:3001/, so the Angular (frontend) container is running perfect.
So the problem is in the proxy_pass from the Nginx. I have tried several approaches already, trying to add some rules, but when I access via the 8080 port (from the nginx) the docker-compose logs outpus:

nginx_1     | 2020/09/16 13:21:50 [error] 28#28: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.18.0.1, server: , request: "GET / HTTP/1.1", upstream: "http://172.18.0.5:3001/", host: "localhost:8080"

Source: Docker Questions