I have a container that listens to port 8080. I want to spin up 3 instances of the same container on the same host without having to do port forwarding. I want to access each of the instances using a unique IP.
I am running Docker via Boot2Docker since I am running it on a Mac machine. I do not intend to run multiple instances of Boot2Docker as it is memory intensive.
The reason I do not want to do port forwarding is because my application is a distributed application. Each node in the cluster assumes that its peer is running on the same port.
(Maybe there are better solutions within boot2docker.)
For a fast solution, I recommend to do this via Vagrant.
** review this document. https://coreos.com/docs/running-coreos/platforms/vagrant/
update
config.rb
file** start vagrant with three CoreOS instances. Start the machine(s):
List the status of the running machines:
** login each instance and start the docker container
Another way to do that is via Docker machine
Machine makes it really easy to create Docker hosts on your computer, on cloud providers and inside your own data center. It creates servers, installs Docker on them, then configures the Docker client to talk to them.
Relative document : https://docs.docker.com/machine/