There are 2 services in docker-compose:
service1:
image: "service1:latest"
container_name: service1
ports:
- "3011:3000"
service2:
image: "service2:latest"
container_name: service2
depends_on:
- service1
ports:
- "2000:2000"
Dockerfile for servise2:
FROM nginx:latest
COPY nginx/nginx.conf /etc/nginx/nginx.conf
COPY --from=build /usr/local/app/dist/app /usr/share/nginx/html
EXPOSE 2000
And nginx.conf:
http {
server {
listen 2000;
server_name localhost;
...
location ^~ /service1 {
proxy_pass http://service1:3011$request_uri;
}
}
}
Why am I getting an error when I send request via postman and how can I improve that?
*2 no resolver defined to resolve service1, client: 172.30.0.1, server: localhost,
request: "GET /service1 HTTP/1.1", host: "localhost:2000"