Forwarding ports from a docker container with Vagrant 1.6
Vagrant 1.6 has a really nice feature which allows you to run a docker environment from any machine that can run Vagrant (even a Mac)
Behind the scenes, Vagrant creates a host VM which runs the docker containers.
The "gotcha" is: Vagrant won't automatically forward ports all the way back from the container->vagrant host VM->your mac. You have to do that step manually, by configuring your own host VM for Vagrant to use for hosting docker containers with. That host VM is told what ports to open.
Here's how I set up a local Wordpress development testing container.
Directory structure looked like this (see attached files in this gist):
├── Vagrantfile ├── docker-host-vm │ └── Vagrantfile
vagrant up does the magic and Wordpress
:80 on the Docker container is forwarded to 8080 on the
docker-host-vm, which is forwarded to
localhost:8080 on my Mac.