1

I'm pretty new to Docker and I'm trying to create a docker image that clones a github repo with a very simple Angular application and runs it in the container. Then I want to access this running Angular application in my browser.

This is my Dockerfile:

FROM node:latest

RUN apt-get update && apt-get install -y git

WORKDIR /usr/src/app

RUN git clone https://github.com/path-to-repo.git

WORKDIR /usr/src/app/docker-angular

RUN npm install -g @angular/cli

RUN npm install

CMD ng serve --port 5000

I build the image and I'm running the container with the following command

docker container run -d -p 5000:5000 --name [container-name] [image-name]

When i check the logs i see that the application is running successfully in the container, but when i try to access it in my browser on localhost:5000 it's not there. This is the output when I run docker container ls:

806a71aa5972        angular-app         "docker-entrypoint.s…"   24 minutes ago      Up 24 minutes       0.0.0.0:5000->5000/tcp   sample-angular 

Can I access the application that is running in the container from the browser and how should I do that?

slavhadz
  • 47
  • 5

0 Answers0