- #MAC M1 BREW INSTALL DOCKER HOW TO#
- #MAC M1 BREW INSTALL DOCKER UPDATE#
- #MAC M1 BREW INSTALL DOCKER PORTABLE#
I have found that occasionally it will run wild with the CPU for a couple dozen seconds as it updates its index (or something), but it hasn't significantly affected my development, especially not when compared against the incredible speed upgrades it provides. The first time you run this will be longer than before, as Mutagen will need to create the sync mount and perform the initial synchronization, but then it will run as a daemon and keep changes automatically in sync.
#MAC M1 BREW INSTALL DOCKER HOW TO#
docker-compose doesn't know how to read an x-mutagen entry, so instead we now run this file with the mutagen compose command, which is essentially a pass-through to docker-compose after having performed the various sync setup steps you've defined.
#MAC M1 BREW INSTALL DOCKER UPDATE#
Since this is development and the files on the host system are the canonical ones anyway, this is safe and prevents conflicts that have to be manually resolved.įinally, we have to update our volumes entry to use the new mount point: volumes:Īnd that's it! Well, that's nearly it. Mutagen has great documentation on how its synchronization modes work, but in short, we're using the mode that prioritizes host files. Also of note is the two-way-resolve sync mode we're using. mutagen compose will read that and build your sync from the options you set there: x-mutagen:Īlpha is where you're syncing from, and beta is the sync mount point that Mutagen will create. You'll want to create a new section at the bottom of your file with an x-mutagen configuration. Assume your current volumes entry for a container looks like: volumes: Next, you'll need to modify your docker-compose.yml file to define the sync that Mutagen will spin up. To install Mutagen and start the sync daemon, first, make sure you have Homebrew installed, and then: $ brew install mutagen-io/mutagen/mutagen-beta There should be fairly low risk from this, though, since Mutagen's own website says: Beta channel releases are fairly stable and can be thought of as something akin to release candidates. We need version 0.12.0 or higher, since that's the version that starts supporting mutagen compose (which we'll get to in a minute). So now that we know what the problem is and what the solution is, let's fix Docker on MacOS.įirst, you have to install Mutagen, and as of the writing of this article, you need to install a beta release. My Jest test suite went from taking 73.5 seconds to run to only taking 22.9 seconds (on average). How fast is it? Well, the title of this article isn't hyperbole, in fact, it's underselling things.
Mutagen does a lot of things and is a very interesting technology in general, but what we're primarily interested in is how it can perform lightning-quick syncs between your local computer and a Docker volume. Compounded, that means that even your average runs are bitterly slow.Įnter Mutagen. As your Docker app runs, it reads and changes files across that sync, which means that every file access slows down your application a little bit more. Sure, it's consistent and compatible, but it's just about the slowest possible option you could go with. The problem is that the default file sync strategy that Docker on MacOS uses is garbage.
#MAC M1 BREW INSTALL DOCKER PORTABLE#
It turns out that developing with Docker on MacOS can actually be a really enjoyable experience, not just a compromise you make in order to have a portable development environment. In fact, you can get it pretty close to native speed and it's not even all that difficult. Docker on MacOS will always be slower than on Linux (well, unless Apple Silicon ends up panning out, which it looks like it might!), but it doesn't have to be as infuriatingly slow as it is by default.