I'm developing an ionic study app to learn Docker.
I did all the steps to create the image:
1 - I created the Dockerfile whit scripts:
FROM node:18.10.0-alpine3.15
WORKDIR /app
COPY . .
RUN npm i
EXPOSE 4200
CMD ["npm", "start"]
2 - In directory of Dockerfile for CMD executed docker build -t mcd . and then docker run -p 4200:4200 mcd
3 - The application execute no errors. But can't open application in the browser in url localhost:4200.
Where's the error?
I executed the commands:
docker run -p 4200:4200 mcd
docker run -d -p 4200:4200 mcd
docker run mcd
I had the same problem :)
The solution is to modify package.json and put ng serve --host 0.0.0.0 --port 4200 to start