I’m using Docker on Mac since 3 years and same as you, I was using it only to run project. It was always simple running “docker-compose up -d”.
It looked exactly like Vagrant or simple image runned on VirtualBox. There were benefits of using Docker on production, Docker on Linux environment. On MacOs, however, it gave me more problems than solutions.
Since always, I have installed Composer on my Mac. Ages ago, I run “brew install composer” and it was there always. Till now. I’ve removed brew and all libraries managed by brew.
Don’t get me wrong, brew is good software. I’ve even wrote the Ultimate Guide of brew. But when I’ve worked with different version of different libraries, I’ve never know what version of e.g., php I will use.
Finally, I’ve moved evertyhing to Docker. Composer is just a little example.
If you already used Docker, you probably know that command can be prette huge. Simple “composer install” will:
docker run --init --tty --rm \
-v $(pwd):/p:delegated \
-v composer_data:/tmp:delegated -w /p \
-- composer install
Of course, I don’t want type this command everytime when I want install dependency, update or do anything else with Docker.
Simple, one line of code added to my “~/.bash_profile”
alias composer='docker run --init --tty --rm -v $(pwd):/p:delegated -v composer_data:/tmp:delegated -w /p -- composer'
What is a result? I can use again “composer install”, but this time “composer” is loaded always from Docker.
What about performance?
If you are experienced user of Docker on Mac, you probably noticed issue realted with performance and fast acces to files. In other words, installing dependencies through Docker can be 100x slower than do it normal way.
However, I’ve speed up Docker on Mac even more than 100x. Today it work much faster, than any native solution instaled by brew.
I want to prepare Ultimate Guide to Speed up Docker on Mac. If you want be one of firsts reader, let’s join to my newsletter. Tomorrow, this Guide can be the most expensive book on your bookstore.
If you want to help me, and propose some subject to describne in Ultime Guide, bellow is also form to do that.