PS: this is an experimental idea so it might not work for you.
I’ll try to make short here, so basically you will have to pass the IP with the expose port while you execute
docker run for example something like
docker run -p 10.0.0.10:5000:5000 -name container1 <someimage> <somecommand>
Now the question why do I need to do something like that since at the end docker will be bind to localhost and more specific to
0.0.0.0 , and to be honest this is just a simple try for me to imitate the ability to have two (or more) vagrant boxes running on the same machine and both has the port
80 exposed to the host.
So normally you will only have one image cause you cant have two images on the same port (or at least this is what I have in my mind right now), so the command above will help, now when you try it you will face a small problem, which is that the IP should be the same as your host IP and you cant have both images have the same IP, so it wont work and we have gain nothing, lets talk about how vagrant/virtualbox work, they do a small trick where virtualbox will create a virtual network adapter and configure it to have the IP which you specified in Vagrantfile, so I guess we will have to do the same Creating a new virtual network adapter.