Home > Net >  Web app not accessible while using yarn in docker
Web app not accessible while using yarn in docker

Time:06-14

I am trying to run a web app inside docker via yarn. Here's the docker file

FROM ubuntu:20.04

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update -y && apt-get upgrade -y

ENV TZ=Pacific/Auckland
RUN echo $TZ > /etc/timezone && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime

RUN apt-get install curl -y
RUN apt-get install npm -y
RUN apt-get install git -y
RUN npm cache clean -f
RUN npm install -g n
RUN n stable
RUN apt remove cmdtest -y
RUN apt remove yarn -y
RUN npm install -g yarn -y
RUN git config --global url."https://".insteadOf git://

EXPOSE 8080

COPY . .

RUN yarn
CMD yarn start

When I run yarn start as a non-docker the web app is accessible via localhost:8080

However when I start the docker instance via docker run -p 8080:8080 -itd webapp:latest & launch web browser & type in http://localhost:8080 the webapp isn't accessible.

Running docker logs against the container doesn't show any errors.

When I run curl, here is the error I see

curl "http://localhost:8080"
curl: (56) Recv failure: Connection reset by peer

I've no clue what is going on. Please could I request help to fix this problem.

CodePudding user response:

the IP had to be bound on multiple interfaces for this to start working

  • Related