Crane is a Docker orchestration tool similar to Docker Compose
with extra features and ultra-fast bind-mounts on Mac.

Accelerated Mounts on Mac

Crane can optionally make use of Unison to have faster bind-mounts between the host and Docker for Mac. This feature is available in the PRO version only. Example configuration:

services:
  hello:
    image: alpine
    rm: true
    interactive: true
    tty: true
    volume:
      - "foo:/bar"
accelerated-mounts:
  hello:

When Crane is asked to run the hello service, it automatically sets up an accelerated mount for foo:/bar. Behind the scenes, Crane starts a sync container (which is using Unison internally) connected to a plain Docker volume, which is then mounted to /bar in the hello container. From a user perspective however, everything looks as if the host directory foo is directly bind-mounted to /bar in the container.

Accelerated mounts can either be specified using a service name (then all configured bind-mounts of this service are accelerated), or by specifying a specific bind mount. The example above is equivalent to:

accelerated-mounts:
  "foo:/bar":

To reduce the amount of syncing that needs to be done, different containers or multiple instances of the same container definition share the same sync container and volume.

It is possible to customize each accelerated mount:

  • uid/gid: Defaults to 0/0. Set this to the user/group ID the consuming container expects, e.g. 1000/1000.
  • ignore: Defaults to Name {.git} and allows to exclude files / folders from the sync. See Ignoring Paths for possible values.
  • flags: Defaults to ["-auto", "-batch", "-ignore='Name {.git}'", "-confirmbigdel=false", "-contactquietly", "-prefer=newer"], but can be overriden using anything that you can pass to unison, see its manual.

To debug what is happening when the sync is not behaving as expected, you can use:
crane am logs -f hello. To remove the sync, use crane am reset hello.

Copyright © 2018 Michael Sauter — Contact