Curl: (56) Recv failure: Connection reset by peer

I have frontend running inside a docker container and nginx is serving it i can access that thing inside a container by exec command but cant when i try to access it locally eg

nworks@nworks-MS-7E32:~$ docker exec -it 1a893ea9b172 sh
/ # curl -v localhost:80
Request completely sent off
responce simplefied

< HTTP/1.1 200 OK
< Server: nginx/1.27.5
< Date: Mon, 16 Feb 2026 12:10:04 GMT
< Content-Type: text/html
< Content-Length: 525
< Last-Modified: Mon, 16 Feb 2026 10:25:47 GMT
< Connection: keep-alive
< ETag: "6992f0ab-20d"
< Accept-Ranges: bytes

outside the container
1a893ea9b172 gh “/docker-entrypoint.…” 2 hours ago Up 2 hours 0.0.0.0:8050->80/tcp, [::]:8050->80/tcp sellclub-frontend-staging
nworks@nworks-MS-7E32:~$ curl localhost:8050
curl: (56) Recv failure: Connection reset by peer
nworks@nworks-MS-7E32:~$

that port is not taken

Nginx config

server {
  listen 80;
  server_name _;

  root /usr/share/nginx/html;
  index index.html;

  location / {
    try_files $uri $uri/ /index.html;
  }

  location /assets/ {
    try_files $uri =404;
  }
}

dockerfile

# syntax=docker/dockerfile:1

FROM node:20-alpine AS build

WORKDIR /app

COPY package.json package-lock.json ./

RUN npm ci

COPY . .

ARG VITE_API_BASE_URL

ENV VITE_API_BASE_URL=$VITE_API_BASE_URL

ARG VITE_MAPBOX_TOKEN

ENV VITE_MAPBOX_TOKEN=$VITE_MAPBOX_TOKEN

RUN npm run build

FROM nginx:1.27-alpine

COPY --from=build /app/dist /usr/share/nginx/html

COPY nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]

If the forwarded port doesn’t work from the host, the process inside the container likely listens only on localhost. Why, I don’t know as nginx shoudl listen on all IP addresses and I don’t recognize errors in the shared nginx config. Try curl in the container but not on localhost but on the container IP address. If that doesn’t work, that is the problem.