Dear Diary!
Docker for Mac has a know problem with mounted volumes speed.
I tested that container’s root volume had almost NO speed compromise vs mounted volume.
You can test speeds using dd for root volume, location can be just /tmp. I tested this on ubuntu:14.04 image.
dd if=/dev/zero of=/tmp/output bs=8k count=300k; rm -f /tmp/output
Root volume speed tests gave me around 1.1 GB/s on my i7 Mac with 500GB SSD.
You can test speeds using dd for mounted volume, location can be your mounted volume like /mnt/dv. I tested this on ubuntu:14.04 image.
dd if=/dev/zero of=/mnt/dv/test_output_disk_vjuRqc bs=8k count=300k; rm -f /mnt/dv/test_output_disk_vjuRqc
It gave me around 10 to 50 MB/s. Most of the times it will like to stay below 20 MB/s.
This was insanely slow for my heavy WordPress stores.
So, the easy solution is…
Just “rsync -avP …” your wordpress folder from mounted folder to root folder to /var/www which should be the apache2’s vhost’s default home dir.
Now, go to mounted wordpress folder and remove all files and folders except wp-content/uploads
Now, go to root volume’s wordpress folder at /var/www and delete folder wp-content/uploads and create a symbolic link for the folder from mounted wordpress folder.
Thats it.
I did this for uploads folder because it has so many images and other files which were not needed in container’s root folder.
Please do your configuration accordingly. The way I did now processes all PHP files with fast speeds in container’s root folder and will load images and other uploaded wordpress files from mounted folder.
I am also using a separate container for hosting mysql-server. And, at first I thought that database is slow. But no, mysql database is also super speedy as it also uses docker’s shared root volume.