Install Discourse for development using Docker

From my Ubuntu VM I was able to ping I don’t know if there’s a way to check if the docker container can. I think I only pinged the http version, not https, though. Mentioning in case the problem is related to that. (One of the pages I saw when googling suggested changing https to http, but it’s not like I can do that since the defined behavior is somewhere in the docker container.)

1 Like

I’ve tried the MacOS options.

First using Option 2, Homebrew. I ran into issues though as not all dependencies were installed using the command of this guide. A complete one-by-one guide to install Docker on your Mac OS using Homebrew helped me getting a bit further.

I’m now stuck at Step 2 d/boot_dev --init:

Migrating database...

rake aborted!

PG::ConnectionBad: could not connect to server: No such file or directory

Is the server running locally and accepting

connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

/src/lib/site_settings/db_provider.rb:61:in `table_exists?'

/src/lib/site_settings/db_provider.rb:16:in `all'

/src/lib/site_settings/defaults_provider.rb:29:in `db_all'

/src/lib/site_setting_extension.rb:277:in `block in refresh!'

/src/lib/site_setting_extension.rb:274:in `synchronize'

/src/lib/site_setting_extension.rb:274:in `refresh!'

/src/lib/site_setting_extension.rb:495:in `block in setup_methods'

/src/config/initializers/004-message_bus.rb:120:in `<main>'

/src/config/environment.rb:7:in `<main>'

/usr/local/bin/bundle:23:in `load'

/usr/local/bin/bundle:23:in `<main>'

Tasks: TOP => db:migrate => db:load_config => environment

(See full trace by running task with --trace)

I’ve then downloaded the .dmg file but as I’m new to Docker, I don’t understand what to do from there. It would be great to have a little more detailed description of the macOS option.


1 Like

On MacOS, once you install Docker from the .dmg, just make sure it’s running — there should be an icon on the MacOS toolbar that you can use to check its status. Then literally follow the steps on the first post (clone, etc). Post here if you hit a problem going that route.

Mind, if you have installed docker with Homebrew before, it may be a good idea to uninstall that docker first or at least making sure that one is not running. I never installed docker with homebrew, so can’t advise there.



I’ve used the icon and opened the Docker dashboard. I didn’t find any containers running there on the command line I could see multiple containers running though. I was wondering if I had to sign in to use Docker dashboard? Or maybe this behaviour occurs since there are multiple versions of Docker installed Homebrew and Desktop (.dmg)?

In the meantime I’ve managed to setup Discourse on DigitalOcean which works without problems and is okay for my purposes.

1 Like

The DMG installs docker, not discourse. It won’t add any containers initially.

From there you can follow the docker guide.


When running the above command (on a Mac) I get this error:

An error occurred while installing cppjieba_rb (0.3.3), and Bundler cannot continue.

Make sure that `gem install cppjieba_rb -v '0.3.3' --source ''` succeeds

before bundling.

Do you have any suggestions? I don’t understand exactly what the problem is. The separate gem install doesn’t work either (even with sudo).

Also, why do gems have to be installed when I’m running a docker image? That should have been fully pre-installed already, right?


I cloned to ~/repos/discourse but should have been to ~/discourse. Works like a charm now.


If you get this error when running d/unicorn:

Could not find aws-partitions-1.284.0 in any of the sources
Run `bundle install` to install missing gems.

you can fix this by running:

docker exec -it -u discourse:discourse discourse_dev /bin/bash -c "cd /src && USER=discourse RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 LD_PRELOAD=/usr/lib/ RAILS_ENV=${RAILS_ENV:=development} bundle install"

after which d/boot_dev will run succesfully.



d/bundle install

We have helpers for all the usual tasks.


In the OP it reads

The Docker development flow supports symlinks under the plugins/ directory

What do we symlink the plugins directory to in this context? Thanks!

1 Like
cd plugins
ln -s /full/path/to/your/plugin .
ln -s ~/src/my-great-plugin # for example

Ah thanks just meaning to symlink to the plugins directory in this context.

1 Like

Generally you don’t symlink an entire directory for this workflow as you would normally want granular control over which plugins were in scope during a run.


Hi, I’m using this guide and it works fine but my concern is whenever I run d/boot_dev it start downloading various things. How to just download once the necessary files and keep them for next boot? My OS is ubuntu 20.04

1 Like

Tried to install on a fresh Mint 20 system. Docker is available:

terrapop@terrapop:/var$ docker version
Client: Docker Engine - Community
 Version:           19.03.12

terrapop@terrapop:/var/discourse$ sudo systemctl status docker
● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset>
     Active: active (running) since Mon 2020-08-24 19:03:48 CEST; 31min ago

Then cloned Discourse:

sudo git clone /var/discourse
cd /var/discourse

However, d/boot_dev --init leads to:

d/boot_dev --init

bash: d/boot_dev: No such file or directory


1 Like

Update: I have now added our sendgrid api keys to the app.yml and bootstrapped the app via ./launcher and now it runs on localhost. Could it be that those d/commands in the OP are all outdated? Still, don’t get it. The app is now running in docker on my Ubuntu (Mint) computer on localhost like it does on staging at Digital Ocean. We want to develop on localhost having the app running via Docker with symlinks for plugins, but I’m not sure if it’s now ready like it should as I can’t execute those d/ commands in any way. Could someone please chip in? Thanks.

Update: My fault. I took the git link for production:

git clone /var/discourse

Instead of:

git clone



Now running into new problems. I can only clone into /var as superuser/root on Ubuntu Mint 20 (UID 0). So when I clone and run d/boot_dev --init everything downloads and start fine, but when then at a later stage the script throws a Permission Error as it expects to run something with UID 1000, which is the first user created on Mint, thus my personal account (terrapop), and not root. How to get around this problem?

Solution: Simpler than I thought. Just create a new www directory in var. chown and chmod the www directory to your first user on Mint and proceed as in OP’s posts. Works now. Happy.


For some reason symlinks to my plugin source directories were not working and I needed to manually move / copy the plugin source directories into the plugins directory to get them to appear in /admin/plugins after restarting the Docker container.

Perhaps there was a change in how Docker supports symlinks? I’m running docker-ce 19.03.12 on Ubuntu.

1 Like

I have experienced this too recently with Docker Desktop for Mac.

1 Like

I did the same steps in a $5 DO droplet. Everything went fine. Now how do I expose my site so that I can access it ?

P.S. It works with ngrok. Doesn’t yet work with nginx reverse proxy to 9292

Thanks to this. You can do this on the server and avoid configuring nginx reverse proxy. Enjoying d/o docker+vscode remote setup :slight_smile:

use d/unicorn -D to run unicorn as daemon so the shell is still usable after starting the server.

Also you need atleast $10 d/o droplet.


I’m on a Mac with zsh (on iTerm2) and if I try to use symbolic link for plugins development I get stuck with this errors:

readlink: illegal option -- f
usage: readlink [-n] [file ...]

This because the Mac implementation of the readlink command is slightly different from the GNU one.

The easiest way to solve this is by doing this:

# brew install coreutils
# ln -s "$(which greadlink)" "$(dirname "$(which greadlink)")/readlink"

This will give you the possibility to use a compatible readlink version.

Please remember you need to have dirname "$(which greadlink)" value on your PATH in a position preceding the /usr/bin (where usually the original readlink is). On my case PATH is something like /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:... and the symbolik link to greadlink is in /usr/local/bin.

Reference: Fixing "readlink: illegal option -- f" error on a Mac


To run a single plugin test suite, you can do in this way:

# d/rake "plugin:spec[PLUGIN_NAME]"
1 Like