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.
Just saw a more in-depth article on this approach: http://maori.geek.nz/post/vagrant_with_docker_how_to_set_up_postgres_elasticsearch_and_redis_on_mac_os_x