I have switched from using Vagrant to Docker as my local development environment, and I’m still mentally trying to switch :)

To use the vdebug plugin in Vim I have set xdebug up inside the container as follows:

/etc/php5/conf.d/20-xdebug.ini (Debian wheezy)

zend_extension=/usr/lib/php5/20100525/xdebug.so
xdebug.remote_enable=1
xdebug.remote_autostart=0
xdebug.remote_connect_back=1
xdebug.remote_port=9000

And in my ~/.vimrc I have these vdebug settings:

let g:vdebug_options = {"path_maps": {"/var/www": "/home/username/Localdev"}, \
"break_on_open": 0, "watch_window_style": "compact", \
"server" : "172.17.42.1"}

172.17.42.1 is the ip of the bridge created by docker, it can be found by using ip addr and looking for the “docker0” interface.

I create the xdebug ini file in my Dockerfile, see my Docker repository