I am trying to run my app with a docker but i cannot reach the app through localhost:5173 in browser when my docker is running. (I can reach this port when I run my app outside the docker.)
I run docker build -t app .
and then docker run -d -p 5173:5173 app
WORKDIR /frontend
COPY package*.json ./
RUN npm install -g npm@latest
RUN npm install
COPY . .
EXPOSE 5173
CMD ["npm", "run", "dev"]
I am new to docker and have tried bunch of stuff I saw over internet and none of them worked: for example trying to reach the port with ip address of container instead of localhost
.
the docker log is this:
> frontend@0.0.0 dev
2023-08-11 11:54:45 > vite
2023-08-11 11:54:45
2023-08-11 11:54:47
2023-08-11 11:54:47 VITE v4.4.9 ready in 1375 ms
2023-08-11 11:54:47
2023-08-11 11:54:47 ➜ Local: http://localhost:5173/
2023-08-11 11:54:47 ➜ Network: use --host to expose
and the ports are mapped like this:
5173/tcp 0.0.0.0:5173