IMPORTANT NOTE: This solution does not work any more for Mac OS Big Sur or above

Docker is a very nice tool for development. If you are a Mac user, you may experience that the connection to docker is extremely slow. Why docker is slow on Mac?

As I develop some web-based systems by using docker. The slow performance sometimes cause connection timeout (mostly 30 seconds). It is found that mounting volumes from host path will make the web application slow.

Some developers recommend to use the docker-sync which can synchronise the files on the local machine to docker container realtime. But I prefer another workaround which allow you to update the files directly read by docker container. And it does not need to create xml file for configurations.


After a docker is installed on Mac, there is a small “VM” (so-called VM) on behind. And docker allows you share MacOS directories to the “VM”.

By default, the volumes of docker containers are in /var/lib/docker/volumes inside the “VM”. What I want to do is to change the path as a symbolic link which points the host path on your mac.


1. Share your host path to docker in Docker > Preferences > File Sharing > “+”
Click “Apply & Restart” to restart docker to apply the changes.

2. Go into docker “VM” (by using screen)

screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
# You may notice that some messages are suddenly shown.
# Simply press some "Enter"s to ignore them.

3.  Go to docker root folder

cd /var/lib/docker

4. Rename / Remove the existing volume folder

mv volumes volumes.orig

5. Add symbolic link “volumes” to the host path (you should change your host path)

ln -s /Users/youruser/dockerdata volumes

6. Leave “VM” by “Ctrl+a” then “k” then “y”


You can now update the files inside the host path which is read directly by docker container.

Additional Links