Docker-compose Un-usable On Mac Beta
I have been trying with Docker beta on Mac OS and was facing an issue with docker-compose. It was taking ages for the docker-compose commands to get executed. Important update for mac. After digging into a while I figured out that the dns lookup was causing the issues. Docker-compose is trying to resolve localunixsocket.local.
You can get insight into the dns lookup by running sudo tcpdump -A -s0 -nni en0 port 53 For now I've pointed localunixsocket.local to localhost in my /etc/hosts. Now everything is speedy again.
To do the same, you need to edit /etc/hosts file and add the contents: 127.0.0.1 localunixsocket.local Hope someone finds this useful Subscribe to Today I learned Get the latest posts delivered right to your inbox.
In this post, I’ll cover the best way I’ve found to run Docker in my local OSX development environment. This post won’t cover (and has covered in much better detail), or of using it.
Docker Compose File
Before we dive into the setup instruction, it’s worth addressing, why not to use Docker’s own recommended solution,. Why not Docker For Mac? In short the.
The current implementation of the file system results in high CPU usage when syncing (sharing) volumes. As project’s grow to include hundreds of files, the resulting slow down and strain becomes un-usable.
Front end build processes that should be sub-second can take up to a minute. Commands run a slower then in Ubuntu. Tests are magnitudes slower and are excruciating to run. While, hopefully one day will be resolved, until then this is the most reliable and efficient way I’ve found to run Docker on OSX. Install Docker Toolbox Download the.pkg from and follow the GUI’s install steps. This will ensure the following packages are installed.
VirtualBox. Docker (client). Docker Compose. Docker Machine.
$ docker -version Docker version 1.12.5, build 6b644ec $ docker-machine -version docker-machine version 0.8.2, build e18a919 $ docker-compose -version docker-compose version 1.9.0, build 878cff1 Step 2. Create a boot2docker virtual machine with Docker Machine Modify the command below according to your computer’s specs. Once assigned, you cannot modify these settings without destroying then re-creating the VM.
Docker Compose Install
Docker Compose Volumes
Here are the two choices to make.virtualbox-memory - How much memory (in MBs) you want to allow the VM. 4096 (or 4GB) should be the absolute minimum. Typically you want to use half of your computer’s total memory.virtualbox-disk-size - The maximum size (in MBs) allowed for the VM’s disk size. 30000 (or 30GB) is a good choice (you generally don’t want to go below that). With those values chosen, modify then run the following command.
Docker-machine create -d virtualbox -virtualbox-boot2docker-url = -virtualbox-memory '4096' -virtualbox-disk-size '30000' default Step 3. Enabling NFS By default, your /Users/ folders is shared between your host and the VM. This enables you to seamlessly run Docker containers in the VM and still have access to your usual files. To over come those previously mentioned file system issues, we’ll enhance those shared folders with, a high performance network file sharing system.
In order to use NFS on your freshly created VM, you’ll need to install a 3rd party tool, called. You have two installation options, either curl or via brew. $ docker run -rm -it -v $PWD: $PWD -w $PWD alpine /bin/sh $ time dd if =/dev/zero of =speedtest bs =1024 count =100+0 records in 100000+0 records out real 0m 45.11s user 0m 0.19s sys 0m 1.91s There is still room for improvement, as we aren’t at native file system performance yet, but the result is still usable. Conclusion Hopefully soon, this post will be outdated and Docker for Mac file system issues will be resolved. Until then, this setup works for my development needs. How do you run Docker on OSX?
Do you have a better setup than what I’ve outlined above? If so, I love to hear from you. Let me know in the comments or by tweeting at.