Docker Community Forums

Share and learn in the Docker community.

How to access an web application running in Docker container through Browser

docker

(1e8b3c30649b11e8adc0fa7ae01bbe) #1

Initially I have downloaded an image Ubuntu. In addition to that the following things have been added after starting the container using the following command (docker run -it finid/ubuntu-postgres) -Node Js, Postgres, Java.

I have started the container and a random ID has been generated say “2e316b59fa”. Each time I used container ID say “2e316b59fa” to login to the container(docker start -ai 2e316b59fa) .The application is up and running in 9000.

During initial run of the container, we didn’t publish/assign any port no to the container.

How can I access application running in container from browser?

How to assign a port to the container?


(David Maze) #2

Stop the container, delete it, and start it again with a correct docker run -p option.

Deleting containers is extremely routine (because you need to change the docker run options; because there was a software update in the underlying image) so plan ahead and make sure all of the data that needs to be persisted is stored somewhere outside the container, either in an external database or a mounted volume.