kgust
9/12/2016 - 7:40 PM

Useful Docker (For Mac) Information

Useful Docker (For Mac) Information

To reduce the Docker.qcow2 size (there is an offical solution pending)

  1. screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
  2. login as root
  3. dd if=/dev/zero of=/mnt/docker/zero bs=4096 to fill zero bytes into the free space of the ext4 file system under Docker.qcow4, until the disk is full
  4. rm /mnt/docker/zero then all the free space of Docker.qcow2 would be filled with zeros
  5. logout, and detach screen
  6. Finally reduce the the Docker.qcow2 file size, /Applications/Docker.app/Contents/MacOS/qemu-img convert -O qcow2 Docker.qcow2 Docker2.qcow2

Interface alias

sudo ifconfig lo0 alias 10.254.254.254
xdebug.remote_host=10.254.254.254

Retrieving the IP address for the Docker for Mac VM

cat ~/Library/Containers/com.docker.docker/Data/database/com.docker.driver.amd64-linux/slirp/host

Then modify xdebug settings:

xdebug.remote_connect_back=0
xdebug.remote_host=[IP ADDRESS FROM host mentioned above]

raeesiqbal – Jul 7

I have got it working with following configuration:

; xdebug options for HHVM/PHP
xdebug.enable=1
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.idekey="PHPSTORM"
xdebug.remote_host="192.168.1.5" ; My local network IP, which is accessiable inside the container
xdebug.remote_port=9089

NGINX config, set this where you have put other FastCGI configuration

fastcgi_param REMOTE_ADDR "192.168.1.5"; #My local network IP

Make sure to restart the containers after these.

Now goto PHPStorm Preferences -> Languages and Frameworks -> PHP -> Debug: In the Xdebug section, set Debug port to 9089 and Can accept external connections should be checked. Now, click on the phone icon in top right corner in PHPStorm that has caption of Start listening for PHP debug connections. You may want to restart PHPStorm and should have XDebug Helper16 installed and its IDE Key set to PHPSTORM.

Happy debugging :slight_smile: