Beginners Guide to Install Discourse for Development using Docker

What folder did you install into? I had the same problem with permissions when installing into /var/discourse instead of ~/discourse

Also, you should add your username into docker group and run the install scripts without sudo.

Try these steps, they work for me (Ubuntu 18.04):

  • login with your username
  • install docker
wget -qO- | sh
  • add your username to docker group
sudo usermod -aG docker username
  • logout/login (apply group membership)

Run following commands without sudo!

  • clone Discourse
git clone ~/discourse
  • start dev
cd discourse
./bin/docker/boot_dev --init
  • stop dev

Thank you for these detailed instructions! Yes, I installed into var/discourse.

But I’ve since migrated to a digital ocean droplet with Ubuntu 18 due to this issue and several other things (price, support for other great apps). When I install Discourse (soon), I’ll be sure to install to ~/discourse and follow your other directions. Thanks again!

1 Like

We are still talking about the development install, right?

I believe that instructions for dev install were meant for the local machine, although you can still make them work on a remote vps as long as you take heed of this advice:


Is it too much to ask that you make your dev container fully self-contained for cross-platform use? This instance because of how it’s setup can’t be used on Docker for Windows at all. If you can move all of your package loading and installation to the Dockerfile where it belongs, that will remedy the issues. Thanks.

My understanding is that Docker on Windows still runs in a VM that lives in Hyper-V, so that has to run Linux so everything as designed should just work.

The whole point of the Docker setup is that it uses mounts to properly split “local persistent” files from “ephemeral stuff in docker container”.

That hasn’t been the case for several months now. Engine version 18 of Docker for Windows eliminated the need for the Hyper-V instance and having Linux running under it. You can now run Docker in Windows directly on Windows using Docker Desktop and run Linux instances inside of it without issue. Since the boot_dev script in /bin/ used to install/setup/launch the initial instance isn’t Windows-compatible, it means those of us on Docker 2.x for Windows can’t make use of Discourse natively. I imagine there’s likely a way to remedy that simply, but it would probably require moving the install/setup to within the container build (i.e. the Dockerfile) instead of relying on a shell script to do it.

A big appeal of the current setup is all the external helpers. /bin/d/rails c to get a console and so on.

I feel a flow that relies on always being inside a container maybe somewhat trickier.

Maybe give a shot at converting all the helpers to power shell? then we can have windows native rails / rake and so on wrappers?

1 Like

FYI I just ran the test suite on my Linux machine once using docker dev and another using native.

  • Docker Dev: 8m6s
  • Native: 7m55

This very minor diff could be entirely due to randomness. You basically pay no price performance wise for using our docker dev env on Linux and are up and running in seconds.


Is there a big docker cost on Mac though?


Enormous, cause first the Linux that runs Docker needs to be virtualized and second you pay a huge tax on filesystem mounts.


Sam, do you have any best practices for developing plugins within a docker environment you would be willing to share? I can see the appeal of building in this environment and have set it up a few times, but it seems to be a very different mindset from a development stance.

For example, do you do your edits in the local discourse directory and then restart the container or is the flow very different?


The flow should be identical with Docker, only thing you need to be careful about it not having any symlinks inside the plugins directory. As long as you are directly checking out it should “just work” ™ with no fiddling. You do all the edits on local.


Awesome! And glad I asked. I’m stuck in my old ways with symlink and rm -rf tmp. Thanks!


Technically you could get symlinks to work its just you would need to add another mount to the docker dev container. It would require a minor PR to discourse to add support to this, we could walk symlinks and smart mount or something in boot_dev.

1 Like

Does anyone know why the image from discourse is not loading in this mode?

I think this is why your image is not loading.


Thank you for your advice.

I wanted to install plugins, so based on your advice, I retried to google and I found this:

This works well.

Thank you again.

Need bunele install each shutdown_dev then boot_dev, it’s a problem?

I had problems running this on nixos, because the scripts were not POSIX complaint.
I solved the issue with these changes: make docker dev install posix compliant by spirobel · Pull Request #7995 · discourse/discourse · GitHub


Did you test all the helpers? It is quite a sweeping change

1 Like