Docker Community Forums

Share and learn in the Docker community.

What is the best practice to run multiple docker environments simultaneously

I want to run multiple Docker environments simultaneously
The rational is that a stable production environment will always run.
Parallel to that, a development environment and possibly other environments (test, various releases)

I see several options to achieve that:

- run multiple environments on a single Docker machine
the separation between environments is by using a different port, e.g. http://localhost:80 vs http://localhost:81
- run multiple Docker Hosts on the same physical machine
- run multiple machines (physical, or VMs) - this option may require more resources? (for example if using cloud provider)

Is there a best practice to do that?


You can Assign Port on running dockerfile or docker-compose.yml file
Assign port as you wish
Example Like This For docker-compose.yml
- “80:80”
- “443:443”
For Dockerfile
docker run -it -p 80:80 -p 81:81 -p 443:443 bash