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.
#Mac docker network host install
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 docker network host 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.