# Docker



# Mutagen sync

Mutagen provides better performance for synchronizing files on macOS.

# Download

Download Mutagen following the [Installation instructions](https://mutagen.io/documentation/introduction/installation).

Create $HOME/.mutagen.yml

```yaml
sync:
  defaults:
    symlink:
      mode: "posix-raw"
    mode: "two-way-resolved"
    ignore:
      vcs: true
```

# Setup

At the folder you want to sync, run:

```bash
export VOLUME=mutagen-cache
export NAME=your-name-here

docker volume create $VOLUME
docker container create --name $VOLUME -v $VOLUME:/volumes/$VOLUME mutagenio/sidecar
docker start $VOLUME

mutagen sync create --name $NAME --sync-mode=two-way-resolved --default-file-mode-beta 0666 --default-directory-mode-beta 0777  $(pwd) docker://$VOLUME/volumes/$VOLUME
```

## docker-compose


```yaml
# where you want this mounted
    volumes:
      - mutagen-cache:/var/www
      
volumes:
  mutagen-cache:
    external: true
```

# Check status

```bash
mutagen sync monitor
```
# Start

If your sync was stopped, you can restart it with

```bash
mutagen sync resume $NAME
```

# Stop

To stop synching, run

```bash
mutagen sync terminate $NAME
docker volume rm $VOLUME
```