marwenb
(Marwenb)
November 7, 2017, 2:30pm
1
Hello every one,
I’m new to Docker , and i’m wondering how to get two or three instance of the same docker image.
As a result when I execute docker ps i get :
Container-------- Image-------- PORT
web-app-dev-01 ------- WEB-APP ----- 8082:80
web-app-dev-02 --------- WEB-APP ---- 80883:80
Each instance have a unique port and configuration.
Thank you very much for your help.
think
(Think)
November 8, 2017, 11:14am
2
there is no port 80883, so I guess this is just handwritten.
just run it multiple times
docker run -d -p 8082:80 YOUR_IMAGE
and
docker run -d -p 8083:80 YOUR_IMAGE
Then both containers run in the background.
marwenb
(Marwenb)
November 8, 2017, 1:11pm
3
Thank you for your response , but i need just to confirm the result:
#docker ps
CONTAINER ID IMAGE COMMAND PORTS NAMES
xxxxxxxxxxxx nginx xxxxxxxxx 0.0.0.0:7070->80 name
xxxxxxxxxxxx nginx xxxxxxxxx 0.0.0.0:7060->80 name1
Is like this one?
think
(Think)
November 8, 2017, 8:08pm
4
yes, looks good.
and you should be able to check your two webservers on http://localhost:7070 and http://localhost:7060
marwenb
(Marwenb)
November 9, 2017, 7:34am
5
OK , thank you for your response.
momut1
February 20, 2019, 2:00pm
6
I am having trouble making this work. For some reason the container in question (rocker/rstudio) only works in one port (8787) and is not possible to open in another. I can run it in bash, but that’s not what I want. Any advise on how to be able to run a container on multiple ports in such a situation?