I am trying to run ng2 application in docker. I have a Docker file:
FROM ubuntu:latest
RUN apt-get update
RUN apt-get -qq -y install curl
RUN apt-get install -yqq git
RUN curl -sL https://deb.nodesource.com/setup_6.x -o nodesource_setup.sh
RUN bash nodesource_setup.sh
RUN apt-get install -yqq nodejs
RUN apt-get install -yqq build-essential
RUN npm install -g angular-cli
RUN git clone https://github.com/moravianlibrary/RecordManager2.git
WORKDIR /RecordManager2
RUN git checkout webapp_jobs_branch
WORKDIR /RecordManager2/cz.mzk.recordmanager.webapp.gui/gui
EXPOSE 4200
RUN npm install
CMD ["ng", "serve"]
build and run without errors:
docker build -t rm-gui .
docker run --name gui -dp 4200:4200 rm-gui
After starting the application, I see that the application really works:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
caa4f1f820d6 rm-gui "ng serve" 23 minutes ago Up 23 minutes 0.0.0.0:4200->4200/tcp gui
but when I open the page http://localhost:4200/, I see an error This site can’t be reached. What am I doing wrong?
source
share