How to run multiple postgres docker instances on local machine
When working on multiple projects, I run separate postgres instance for each of them.
Since these are docker instances, this is not a problem as long as they are not running at the same time
If I’m actively working working on multiple projects parallelly, then there are two problems :
- Resources : My laptop becomes slow. There is no solution for this 1
- Assuming you have LOTs of memory, second problem still remains. Both
instances try to bind to local port
5432the default port. Which does not work. So you need to bind other postgres instances to different local ports like5433,5434and so on. This is controlled via-pin the docker command.
The format is :