Reputation:
I have an angular and nodejs app. The API's (nodejs) is running on port 8888 The Angular is running on port 8080
Now the app is running in a docker container. The container is running by:
docker run -d -p 49160:8080 --name app localhost:5000/test/app
The problem is. Now I'm able to visiting the API's on localhost:49160 but I don't know how to access my angular. Which is running on another port
Do I need 2 containers? In each tutorial I see it in the same container.
EDIT: this is my dockerfile:
FROM node
# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
RUN npm install -g bower
RUN npm install -g gulp
# Install app dependencies
COPY . /usr/src/app/
RUN bower install
RUN npm install
RUN gulp build
EXPOSE 8080
CMD [ "node", "server.js" ]
My run command is:
docker run -d -p 49160:8080 -p 8888:8888 --name app localhost:5000/test/app
My angular is running on port 8080 and nodejs on 8888.
Upvotes: 1
Views: 3873
Reputation: 5932
You can expose multiple ports of your Docker container by repeating the -p
flag:
docker run -p <host_port1>:<container_port1> -p <host_port2>:<container_port2>
In your case you could do:
docker run -d -p 49160:8080 -p 8888:8888 --name app localhost:5000/test/app
Upvotes: 5