I am creating a container for my node application. I have exposed the port 8888 from the container. So, when i run the docker using:
docker run imageName
then, browse, http://localhost:8888/
. It doesn't work.
But, if run:
docker run -p 8888:8888 imageName
. It works. So this maps, localhost's port to docker container port. But, Is there a way to map these ports other than docker runs' -p
flag
DockerFile
FROM node:alpine
WORKDIR /app
COPY . .
RUN npm install
# Expose a port.
EXPOSE 8888
# Run the node server.
ENTRYPOINT ["npm", "start"]