# 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:** 10

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [December 12, 2023, 10:56am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/274 "2023-12-12T10:56:49Z")

</div>

> [@martyn\_thomas](#):
>
> d/rails admin:create

That should be `d/rake admin:create` I suspect …

---

<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, 10:58am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/275 "2023-12-12T10:58:52Z")

</div>

Sadly no ☹  
`OCI runtime exec failed: exec failed: unable to start container process: exec: "bin/rake": stat bin/rake: no such file or directory: unknown`

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [December 12, 2023, 11:21am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/276 "2023-12-12T11:21:22Z")

</div>

what was the result of: `d/boot_dev --init` ?

---

<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, 11:23am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/277 "2023-12-12T11:23:29Z")

</div>

```plaintext
Using source in: /home/martyn/discourse
Using data in: /home/martyn/discourse/data/postgres
release: Pulling from discourse/discourse_dev
Digest: sha256:b64199f510bd9831af81ba8268bef3beff2abb45d0a264a0e29b35cfc3986f05
Status: Image is up to date for discourse/discourse_dev:release
docker.io/discourse/discourse_dev:release
docker: Error response from daemon: Conflict. The container name "/discourse_dev" is already in use by container "44c83548a9a9060716aa7d4fd803e239227f48375625f1d27da19b3d4162c56a". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.

```

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [December 12, 2023, 12:28pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/279 "2023-12-12T12:28:17Z")

</div>

OK so you have built the container.

That’s very strange. I have just installed in WSL from scratch and it worked for me, though I needed to run `d/exec yarn` manually.

I suggest stopping, deleting your container and starting again and watch out for errors announced in the console.

---

<div class="post-metadata">

### Author: ![brettch](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/brettch/32/348400_2.png) [@brettch](https://meta.discourse.org/u/brettch)
#### Post date: [December 12, 2023, 1:45pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/280 "2023-12-12T13:45:52Z")

</div>

I’ve been working on getting a Discourse dev environment going with the Docker instructions, and I’m seeing errors when running any of the Yarn commands. The Ruby commands work fine, but running `d/yarn` (and any of its subcommands) fail with this error:

```plaintext
discourse(v3.1.3) $ d/exec yarn -v

<--- Last few GCs --->

<--- JS stacktrace --->

#
# Fatal javascript OOM in MemoryChunk allocation failed during deserialization.
#

```

I’m on Fedora 39 with Docker 24.0.7. I haven’t modified anything other than checking out Discourse from Git and changing to the v3.1.3 tag.

Has anyone seen this error before? Thanks!

---

<div class="post-metadata">

### Author: ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)
#### Post date: [December 12, 2023, 1:52pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/281 "2023-12-12T13:52:55Z")

</div>

Sounds like it’s running out of memory:

> [@brettch](#):
>
> `Fatal javascript OOM `

How much RAM does it have?

---

<div class="post-metadata">

### Author: ![brettch](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/brettch/32/348400_2.png) [@brettch](https://meta.discourse.org/u/brettch)
#### Post date: [December 12, 2023, 1:54pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/282 "2023-12-12T13:54:51Z")

</div>

> [@Firepup650](#):
>
> How much RAM does it have?

My machine has 64 GB of RAM, and I don’t believe I’ve set any limits on Docker’s memory usage. I’ve just got a standard Docker install running.

* * *

Edit: it’s interesting, Node commands work but Yarn fails:

```plaintext
discourse(v3.1.3*) $ d/exec node -v
v18.17.1
discourse(v3.1.3*) $ d/exec yarn -v

<--- Last few GCs --->

<--- JS stacktrace --->

#
# Fatal javascript OOM in MemoryChunk allocation failed during deserialization.
#

```

---

<div class="post-metadata">

### Author: ![brettch](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/brettch/32/348400_2.png) [@brettch](https://meta.discourse.org/u/brettch)
#### Post date: [December 15, 2023, 2:28am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/283 "2023-12-15T02:28:15Z")

</div>

A quick update: Node commands fail as well upon further testing:

```plaintext
discourse(v3.1.3*) $ d/exec node --help

<--- Last few GCs --->

<--- JS stacktrace --->

#
# Fatal javascript OOM in MemoryChunk allocation failed during deserialization.
#

```

Anything other than `d/exec node -v` throws that error. 🤔 Will continue to investigate and try to see if I can figure out a solution.

---

<div class="post-metadata">

### Author: ![brettch](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/brettch/32/348400_2.png) [@brettch](https://meta.discourse.org/u/brettch)
#### Post date: [December 15, 2023, 3:12am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/284 "2023-12-15T03:12:20Z")

</div>

I figured out a fix for my problem. It’s a bit of a convoluted, hacky process, but it works. In summary, **upgrading to Node.js 20.x.x fixed my issue**.

I created a Docker image that uses Node.js v20.x.x instead of the default v18.x.x that the Discourse dev Docker image uses.

I started by creating this `Dockerfile`:

```dockerfile
# NAME: discourse_node20
FROM discourse/discourse_dev:release

# upgrade node to LTS 20.x.x
ENV NODE_MAJOR=20
RUN apt-get update
RUN apt-get install -y ca-certificates curl gnupg
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
RUN apt-get update
RUN apt-get install nodejs -y

```

Then I built the image: `docker build -t discourse_node20 - < Dockerfile`

Then I updated `d/boot_dev`’s `docker run` command to use the `discourse_node20` image and _not_ pull `discourse/discourse_dev:release` since it isn’t being used. Here’s that updated command in `d/boot_dev`:

```console
# comment the line below out 
# docker pull discourse/discourse_dev:release
docker run \
    -d \
    -p $local_publish:8025:8025 \
    -p $local_publish:3000:3000 \
    -p $local_publish:4200:4200 \
    -p $local_publish:9292:9292 \
    -p $local_publish:9405:9405 \
    -v "$DATA_DIR:/shared/postgres_data:delegated" \
    -v "$SOURCE_DIR:/src:delegated" \
    -e UNICORN_BIND_ALL=true \
    -e NODE_OPTIONS=--max_old_space_size=8192 \
    $mount_plugin_symlinks \
    $ENV_ARGS \
    --hostname=discourse \
    --name=discourse_dev \
    --restart=always \
    discourse_node20 /sbin/boot

```

From there I was able to successfully `d/boot_dev --init`, `d/rails s`, and `d/ember-cli` giving me a functioning dev environment in Docker 24 and Fedora 39.

* * *

I don’t know _why_ Node 20.x.x fixes the issue. Hopefully this is fixed upstream in the main dev image. I’d be happy to contribute a pull request but upgrading a major dependency seems like something beyond just a drive-by PR by me. 😸 Well, at least I’m unblocked for now!

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [December 15, 2023, 9:56pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/285 "2023-12-15T21:56:58Z")

</div>

Anyone got this working on a Raspberry Pi? (yes I know the production config is supported). What changes/config is needed?

I get:

`WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested`

And then the container just crashes and restarts constantly.

UPDATE: Ah, I see that a supporting image has not yet been introduced? Compare:

> **[discourse/base - Docker Image](https://hub.docker.com/r/discourse/base/tags)**

(which is supported)

with

> **[discourse/discourse\_dev - Docker Image](https://hub.docker.com/r/discourse/discourse_dev/tags)**

There’s no arm64 version listed for latter …

---

<div class="post-metadata">

### Author: ![Daniel\_McQuillen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daniel_mcquillen/32/160806_2.png) [@Daniel\_McQuillen](https://meta.discourse.org/u/Daniel_McQuillen)
#### Post date: [January 6, 2024, 5:45am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/286 "2024-01-06T05:45:36Z")

</div>

Anybody on Mac OS (13.6.3) (Intel) successful in getting Discourse in docker to run…and can share how they got past the `Error: Cannot find module 'esbuild'` error?

I noticed in the boot\_dev application that yarn is never run for the top-level directory, only app/assets/javascripts/discourse:

```plaintext
echo "Yarn install..."
"${SCRIPTPATH}/exec" yarn install --cwd app/assets/javascripts/discourse

```

Therefore it makes sense that esbuild isn’t installed, since that is a dependency described in the top-level package.json.

However, this package.json cannot be installed outside the container, as the wrong version of esbuild will be installed (Mac, not Linux…but the container needs Linux).

Shouldn’t there be a line in boot\_dev just above “installing gems” that looks like this?

```plaintext
echo "Installing top-level package.json ..."
"${SCRIPTPATH}/exec" yarn install

```

When I add a line like that, I can get past the migrations step without an esbuild error…

---

<div class="post-metadata">

### Author: ![natasha\_selvidge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natasha_selvidge/32/235894_2.png) [@natasha\_selvidge](https://meta.discourse.org/u/natasha_selvidge)
#### Post date: [February 9, 2024, 4:03pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/288 "2024-02-09T16:03:56Z")

</div>

Has this been fixed? I got an install up an running, but the next day when I came back to it and ran d/boot\_dev it gave me this warning and will not create my container anymore.

```plaintext
Discourse development is unlikely to work using Docker's architecture emulation.
Please try a native development installation.
Using source in: /Users/n_selvidge/discourse
Using data in: /Users/n_selvidge/discourse/data/postgres
```

---

<div class="post-metadata">

### Author: ![scavin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/scavin/32/115938_2.png) [@scavin](https://meta.discourse.org/u/scavin)
#### Post date: [April 2, 2024, 11:47am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/289 "2024-04-02T11:47:02Z")

</div>

How to install discourse development via http\_proxy?

 ![Appinn-2024-04-02-19.46.02@2x](https://global.discourse-cdn.com/meta/original/4X/a/6/6/a668553a9c562d80cd97827087ac46a061d2565d.png)

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [April 2, 2024, 11:48am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/290 "2024-04-02T11:48:35Z")

</div>

Get in touch with the proxy provider and make sure those calls are permitted?

---

<div class="post-metadata">

### Author: ![wjiamie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wjiamie/32/358180_2.png) [@wjiamie](https://meta.discourse.org/u/wjiamie)
#### Post date: [April 16, 2024, 6:07pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/291 "2024-04-16T18:07:46Z")

</div>

Got the same error when running `d/rails s`,

```plaintext
/home/discourse/.bundle/gems/ruby/3.2.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql_adapter.rb:87:in `rescue in new_client': connection to server at "10.169.51.142", port 5432 failed: Connection refused (ActiveRecord::ConnectionNotEstablished)
	Is the server running on that host and accepting TCP/IP connections?

```

Any help is appreciated!

---

<div class="post-metadata">

### Author: ![bdfl](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@bdfl](https://meta.discourse.org/u/bdfl)
#### Post date: [May 3, 2024, 9:15pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/294 "2024-05-03T21:15:17Z")

</div>

d/rails s returns:  
Error response from daemon: No such container: discourse\_dev

Any suggestions?

---

<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: [May 9, 2024, 1:15am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/295 "2024-05-09T01:15:52Z")

</div>

Did you run `d/boot_dev` first?

---

<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: [May 13, 2024, 1:36am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/296 "2024-05-13T01:36:36Z")

</div>

Hi, can I get it to bind to 0.0.0.0 instead?

![image](https://global.discourse-cdn.com/meta/original/4X/9/d/6/9d663b0a854768477d472a613b19850a6bcea953.png)

 ![image](https://global.discourse-cdn.com/meta/original/4X/f/3/0/f3002f6c1cc3303cdf33eb4c1633a463c5a065ce.png)

---

<div class="post-metadata">

### Author: ![bdfl](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@bdfl](https://meta.discourse.org/u/bdfl)
#### Post date: [May 14, 2024, 6:20pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/297 "2024-05-14T18:20:58Z")

</div>

Yes, I did enter that, thanks. To start over, I assume I delete the container from the Docker GUI as well as the discourse repository folder?

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

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