# Install Discourse for development using Docker

**URL:** https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009
**Category:** Developer Guides
**Tags:** docker, dev-install, how-to
**Created:** [November 16, 2018, 9:40am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009 "2018-11-16T09:40:04Z")
**Posts on this page:** 20
**Page:** 9

<div class="post-metadata">

### Author: ![dsims](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dsims/32/485916_2.png) [@dsims](https://meta.discourse.org/u/dsims)
#### Post date: [March 31, 2023, 4:20pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/253 "2023-03-31T16:20:41Z")

</div>

Same, it errors when trying to bake the admin user profile. It works after adding a step to `yarn install` before creating the admin [as suggested](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/239) by @zergov. I went ahead and created a PR to add it: [DEV: Yarn install to avoid error during initial migration seed by dsims · Pull Request #20866 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/20866)

---

<div class="post-metadata">

### Author: ![GregorSondermeier](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gregorsondermeier/32/299039_2.png) [@GregorSondermeier](https://meta.discourse.org/u/GregorSondermeier)
#### Post date: [April 4, 2023, 11:23am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/254 "2023-04-04T11:23:08Z")

</div>

Follow-up:  
[Docker Rootless mode](https://docs.docker.com/engine/security/rootless/) causes the same permission mapping issues on Linux as Docker Desktop. The workaround I posted will work with this configuration, too.

However, I’m not super confident with the workaround, so I switched to a [native Docker installation](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository) on my Linux system, added my non-sudo user to the `docker` group and now the permissions are mapped correctly inside the container and I can run docker commands without `sudo`.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [April 5, 2023, 5:51pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/255 "2023-04-05T17:51:30Z")

</div>

Thanks @dsims, I just merged the PR 🙌

---

<div class="post-metadata">

### Author: ![Boost](https://avatars.discourse-cdn.com/v4/letter/b/8e8cbc/32.png) [@Boost](https://meta.discourse.org/u/Boost)
#### Post date: [May 1, 2023, 9:23am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/256 "2023-05-01T09:23:58Z")

</div>

I get this far when using podman (trying to run `d/boot_dev --init`):

```plaintext
Installing gems...
Error response from daemon: environment variable "RAILS_ENV" badly formed, must be key=value

```

I guess I’ll need to use the native development environment approach as I’m not going to install docker on my Fedora desktop as it has been really broken for years now (with random stuff like pushing not working) and podman works so much better without any hassle (for projects that support it).

---

<div class="post-metadata">

### Author: ![volanar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/volanar/32/318163_2.png) [@volanar](https://meta.discourse.org/u/volanar)
#### Post date: [June 28, 2023, 8:51pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/257 "2023-06-28T20:51:58Z")

</div>

error  
error Could not write file “/src/app/assets/javascripts/discourse/yarn-error.log”: “EACCES: permission denied, open ‘/src/app/assets/javascripts/discourse/yarn-error.log’”  
error An unexpected error occurred: “EACCES: permission denied, mkdir ‘/src/app/assets/javascripts/node\_modules’”.

---

<div class="post-metadata">

### Author: ![frocm](https://avatars.discourse-cdn.com/v4/letter/f/a3d4f5/32.png) [@frocm](https://meta.discourse.org/u/frocm)
#### Post date: [October 6, 2023, 1:28pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/258 "2023-10-06T13:28:54Z")

</div>

Why do I get this error following by `d/boot_dev --init`?

```plaintext
3.0" has incorrect peer dependency "@uppy/core@^3.2.1".
[4/4] Building fresh packages...
$ ../run-patch-package
patch-package 8.0.0
Applying patches...
@ember/jquery@2.0.0 ✔
babel-plugin-debug-macros@0.3.4 ✔
content-tag@1.1.1 ✔
ember-source@3.28.12 ✔
ember-this-fallback@0.3.1 (1 initial) ✔
ember-this-fallback@0.3.1 (2 themes) ✔
virtual-dom@2.1.1 ✔
Done in 101.54s.
Migrating database...
rake aborted!
Discourse::Utils::CommandError: /src/lib/discourse.rb:138:in `exec': node:internal/modules/cjs/loader:1080
  throw err;
  ^

Error: Cannot find module 'esbuild'
Require stack:
- /src/app/assets/javascripts/theme-transpiler/build.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at Object.<anonymous> (/src/app/assets/javascripts/theme-transpiler/build.js:3:17)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: ['/src/app/assets/javascripts/theme-transpiler/build.js']
}

Node.js v18.17.1
/src/lib/discourse.rb:172:in `execute_command'
/src/lib/discourse.rb:138:in `exec'
/src/lib/discourse.rb:34:in `execute_command'
/src/lib/discourse_js_processor.rb:119:in `build_theme_transpiler'
/src/lib/tasks/assets.rake:313:in `block in <main>'
Tasks: TOP => db:migrate => assets:precompile:theme_transpiler
(See full trace by running task with --trace)

```

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [October 6, 2023, 5:51pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/259 "2023-10-06T17:51:27Z")

</div>

> [@frocm](#):
>
> `Error: Cannot find module 'esbuild'`

Possibly related to this: [Install Discourse for development using Docker - #239 by zergov](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/239)

Maybe try going to the `/var/www/discourse` directory and running:

`yarn install`

---

<div class="post-metadata">

### Author: ![satonotdead](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/satonotdead/32/447830_2.png) [@satonotdead](https://meta.discourse.org/u/satonotdead)
#### Post date: [October 10, 2023, 12:53pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/260 "2023-10-10T12:53:06Z")

</div>

> [@rishabh](#):
>
> Will be slightly slower than the native dev environment on Ubuntu

Does anybody have some benchmarks about it?

I give a search in this topic but I didn’t found this specifically. I wonder if someone tried the normal and docker installation to compare between them 🙂

---

<div class="post-metadata">

### Author: ![syl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/syl/32/98883_2.png) [@syl](https://meta.discourse.org/u/syl)
#### Post date: [October 12, 2023, 8:52pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/261 "2023-10-12T20:52:19Z")

</div>

A few hints for those who are trying to use the procedure described in this topic:

1. Step 1 didn’t work for me. In order to install Docker, I had to use the “convenience script” describe here: [Install Docker Engine on Ubuntu | Docker Docs](https://docs.docker.com/engine/install/ubuntu/#install-using-the-convenience-script)

2. You need `sudo` for all commands

3. There seems to be a missing step 3: you need to create an admin user account. To create a new admin, run the following command: `sudo d/rails admin:create`

4. As stated in the topic, if you use WSL, symlinks to the Windows file system won’t work. If you try anyway, you’ll break the install and end up with missing gems. To get your gems back, run: `sudo d/bundle install`

---

<div class="post-metadata">

### Author: ![lenkobeta](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lenkobeta/32/334656_2.png) [@lenkobeta](https://meta.discourse.org/u/lenkobeta)
#### Post date: [October 21, 2023, 2:41pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/262 "2023-10-21T14:41:44Z")

</div>

Hello.

I’m trying to install the development in a Debian 12.

When I run the command…

```plaintext
d/boot_dev --init

```

… after a while the following error appears:

````plaintext
$ ../run-patch-package
patch-package 8.0.0
Applying patches...
@ember/jquery@2.0.0 ✔
babel-plugin-debug-macros@0.3.4 ✔
content-tag@1.1.2 ✔
ember-source@3.28.12 ✔
ember-this-fallback@0.4.0 (1 deprecation-name) ✔
ember-this-fallback@0.4.0 (2 themes) ✔
virtual-dom@2.1.1 ✔
Done in 70.39s.
Migrating database...
rake aborted!
Discourse::Utils::CommandError: /src/lib/discourse.rb:138:in `exec': node:internal/modules/cjs/loader:1080
  throw err;
  ^

Error: Cannot find module 'esbuild'
Require stack:
- /src/app/assets/javascripts/theme-transpiler/build.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at Object.<anonymous> (/src/app/assets/javascripts/theme-transpiler/build.js:3:17)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: ['/src/app/assets/javascripts/theme-transpiler/build.js']
}

Node.js v18.17.1
/src/lib/discourse.rb:172:in `execute_command'
/src/lib/discourse.rb:138:in `exec'
/src/lib/discourse.rb:34:in `execute_command'
/src/lib/discourse_js_processor.rb:119:in `build_theme_transpiler'
/src/lib/tasks/assets.rake:313:in `block in <main>'
Tasks: TOP => db:migrate => assets:precompile:theme_transpiler
(See full trace by running task with --trace)```

Am I doing something wrong?
````

---

<div class="post-metadata">

### Author: ![grant\_vanderwaal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/grant_vanderwaal/32/335539_2.png) [@grant\_vanderwaal](https://meta.discourse.org/u/grant_vanderwaal)
#### Post date: [October 25, 2023, 9:56am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/264 "2023-10-25T09:56:22Z")

</div>

```plaintext
yarn install # this will reinstall everything including esbuild
# removing previously error installed container
docker stop discourse_dev
docker rm discourse_dev
d/boot_dev --init
# It will prompt you input admin email if succeed.

```

---

<div class="post-metadata">

### Author: ![Darojax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darojax/32/335774_2.png) [@Darojax](https://meta.discourse.org/u/Darojax)
#### Post date: [November 15, 2023, 4:35pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/265 "2023-11-15T16:35:34Z")

</div>

Hello. After having placed a symlink in the discourse/plugin directory and then restarting:

`$ d/rails s`

I get the following error:

`https://github.com/rails/sprockets (at 3.x@f4d3dae) is not yet checked out. Run `bundle install` first`

“Bundle install” does not resolve the issue. I’ve tried a bunch of things, but nothing seems to resolve this. If I remove the symlink in the plugins directory and restart, everything works fine again. I’ve tried it with different official plugins that I know are working on other discourse installations.

Anyone knows why this happens?

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [November 16, 2023, 12:33pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/266 "2023-11-16T12:33:54Z")

</div>

Can you try `d/bundle install` instead?

---

<div class="post-metadata">

### Author: ![Darojax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darojax/32/335774_2.png) [@Darojax](https://meta.discourse.org/u/Darojax)
#### Post date: [November 16, 2023, 2:10pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/267 "2023-11-16T14:10:30Z")

</div>

I can run `d/bundle install`, that works and I can then start everything, but the plugin doesn’t appear installed in discourse.

So I run `d/shutdown_dev; d/boot_dev` but after that it gives the old error message again `https://github.com/rails/sprockets (at 3.x@f4d3dae) is not yet checked out. Run `bundle install` first`

vOv

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [November 20, 2023, 1:05am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/268 "2023-11-20T01:05:25Z")

</div>

I have improved this in

[https://github.com/discourse/discourse/pull/24453](https://github.com/discourse/discourse/pull/24453)

It is definitely confusing to keep having to run `d/bundle install` manually each time you boot the dev environment. In the mean time, you will unfortunately have to run `d/bundle install` each time you run `d/boot_dev`.

---

<div class="post-metadata">

### Author: ![darkpixlz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darkpixlz/32/549896_2.png) [@darkpixlz](https://meta.discourse.org/u/darkpixlz)
#### Post date: [November 28, 2023, 1:46am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/269 "2023-11-28T01:46:37Z")

</div>

I keep getting this error.

error Could not write file “/src/app/assets/javascripts/discourse/yarn-error.log”: “EACCES: permission denied, open ‘/src/app/assets/javascripts/discourse/yarn-error.log’”

error An unexpected error occurred: “EACCES: permission denied, mkdir ‘/src/app/assets/javascripts/node\_modules’”.

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [November 28, 2023, 2:14am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/270 "2023-11-28T02:14:55Z")

</div>

hmmm 🤔 I think that is the same one as [here](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/257) - can’t find where it was resolved anywhere tho.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [November 28, 2023, 2:48am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/271 "2023-11-28T02:48:33Z")

</div>

Are you running this as a non-root user without sudo?

---

<div class="post-metadata">

### Author: ![darkpixlz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darkpixlz/32/549896_2.png) [@darkpixlz](https://meta.discourse.org/u/darkpixlz)
#### Post date: [November 28, 2023, 2:59am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/272 "2023-11-28T02:59:30Z")

</div>

It was the root user.

---

<div class="post-metadata">

### Author: ![martyn\_thomas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martyn_thomas/32/344874_2.png) [@martyn\_thomas](https://meta.discourse.org/u/martyn_thomas)
#### Post date: [December 12, 2023, 9:54am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/273 "2023-12-12T09:54:26Z")

</div>

I’m trying to install Discourse Development in a WSL Docker - I’ve got as far as the congratulations screen, but without an admin account i’m stuck.

When i try and run `d/rails admin:create` i get the error `stat bin/rails: no such file or directory: unknown`

What am i missing?

Thanks

[Previous page](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009.md?page=8)

[Next page](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009.md?page=10)
