Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
How to run multiple containers of the same image and expose different ports?
I have built a droplet with Ubuntu 18.04 and Docker CE edition. For teaching purposes, I want to run 18 times the same container based on a Docker image hosted on DockerHub: https://hub.docker.com/repository/docker/scienceparkstudygroup/master-gls
When I run one container and expose it on the 8787 port, everything runs smoothly and I can access the RStudio instance at my droplet IP address + :8787.
docker run --rm --name rstudio -e PASSWORD=mypwd -p 8787:8787 scienceparkstudygroup/master-gls:openr-latest
My problem is to create multiple instances of the same container but expose it to different ports. I have tried Docker-compose but no success so far.
In advance thank you
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×