# Running Discourse on Docker for Mac

**URL:** <https://meta.discourse.org/t/running-discourse-on-docker-for-mac/49682>\
**Category:** Development\
**Created:** [2016 年9 月 3 日 19:28 UTC](https://meta.discourse.org/t/running-discourse-on-docker-for-mac/49682 "2016-09-03T19:28:23Z")\
**Posts on this page:** 1\
**Showing post:** 22

<div class="post-metadata">

作者： ![xrav3nz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xrav3nz/32/76894_2.png) [@xrav3nz](https://meta.discourse.org/u/xrav3nz)\
发布日期： [2018 年1 月 12 日 05:30 UTC](https://meta.discourse.org/t/running-discourse-on-docker-for-mac/49682/22 "2018-01-12T05:30:09Z")

</div>

`docker-sync` user here ✋

Essentially, I created a modified version of `bin/docker/boot_dev` to start the container in detached mode with the `docker-sync`’ed volumes, so the rest of the Discourse `bin/docker` scripts would still work.

* * *

This is how I structured everything.

```plaintext
.
|-- src/
|-- docker-sync.yml
|-- up
|-- down

```

`src/` is the cloned Discourse git repo.

`up` is the aforementioned modified `boot_dev` script, to `docker-sync start` and start the docker container; `down` stops `docker-sync` and the docker container.

> **My \`docker-sync.yml\`**
>
> ```yml
> version: "2"
> 
> options:
> verbose: true
> syncs:
> discourse-sync:
> src: './src'
> sync_userid: '1000'
> sync_groupid: '1000'
> sync_excludes: ['tmp/cache', '.DS_Store', '._*', 'data/postgres*', 'log/development.log']
> postgres-sync:
> src: './src/data/postgres'
> sync_userid: '107'
> sync_groupid: '112'
> 
> ```

> **Critical snippet in \`up\`**
>
> ```bash
> docker-sync start
> 
> docker run -d -p 1080:1080 -p 3000:3000 \
> --volumes-from discourse-sync \
> --volumes-from postgres-sync \
> -v "postgres-sync:/shared/postgres_data:nocopy" \
> -v "discourse-sync:/src:nocopy" \
> -e BUNDLE_PATH=/src/vendor/bundle \
> --hostname=discourse \
> --name=discourse_dev \
> --restart=always \
> discourse/discourse_dev:release /sbin/boot
> 
> ```

I kinda forgot why I have two separate sync’ed volumes: one for the database and another for the source code.

Never got around to perfect the script since it just works 😅 Lemme know if you’ve any questions!

---

_[View the full topic](https://meta.discourse.org/t/running-discourse-on-docker-for-mac/49682)._
