# Developing Discourse using a Dev Container

**URL:** https://meta.discourse.org/t/developing-discourse-using-a-dev-container/336366
**Category:** Developer Guides
**Created:** [November 15, 2024, 4:44pm UTC](https://meta.discourse.org/t/developing-discourse-using-a-dev-container/336366 "2024-11-15T16:44:08Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![gormus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gormus/32/428592_2.png) [@gormus](https://meta.discourse.org/u/gormus)
#### Post date: [July 8, 2025, 1:02pm UTC](https://meta.discourse.org/t/developing-discourse-using-a-dev-container/336366/7 "2025-07-08T13:02:28Z")

</div>

If you are using [OrbStack](https://orbstack.dev/) (not affiliated) on your local macOS environment, and want to run Discourse on HTTPS with a custom domain, update your `devcontainer.json` with following additions:

1. Give a name to the container.
2. Add `.orb.local` wildcard domain to `RAILS_DEVELOPMENT_HOSTS` environment variable (hostnames must be separated by a comma).

```diff
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -13,10 +13,11 @@
   ],
   "remoteUser": "discourse",
   "remoteEnv": {
- "RAILS_DEVELOPMENT_HOSTS": ".app.github.dev",
+ "RAILS_DEVELOPMENT_HOSTS": ".app.github.dev,.orb.local", // Step 2
     "PGUSER": "discourse",
     "SELENIUM_FORWARD_DEVTOOLS_TO_PORT": "9229",
   },
+ "runArgs": ["--name","discourse"], // Step 1
   "mounts": [
     "source=${localWorkspaceFolderBasename}-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume",
     "source=${localWorkspaceFolderBasename}-pg,target=/shared/postgres_data,type=volume",

```

~~p.s. please let me know, if you know how I can set the `*.orb.local` hostname and the container name dynamically, as it is defined for GitHub Codespaces. Setting the value as `.app.github.dev,.orb.local` didn’t work for me.~~

**Update:** Somehow, I was missing a record in my `/etc/hosts` file. After adding this line, I was able to use `.orb.local` wildcard domain in step 2.

With these changes in the `devcontainer.json` file, now I can run my local Discourse instance at [https://discourse.orb.local/](https://discourse.orb.local/)

> **/etc/hosts**
>
> Add this line to your `/etc/hosts` file if you don’t already have it.
> 
> ```ini
> ##
> # Docker and OrbStack
> ##
> 127.0.0.1 host.docker.internal
> 
> ```

**Bonus tip 1**  
If somehow your network settings, or your company VPN network, etc conflicts with OrbStack’s Container IP ranges, update your OrbStack with a different range.

> **[Container IP ranges ​ - Container networking · OrbStack Docs](https://docs.orbstack.dev/docker/network#container-ip-ranges)**
>
> OrbStack uses a custom-built virtual network stack designed to be seamless. It implements all common networking features, including IPv6, ping, and traceroute, and follows your VPN and DNS settings. The network is optimized for speed, with up to 45...

**Bonus tip 2**  
If you omit the step 1, OrbStack will create a randomly named container, but you will still be able use HTTPS without appending any port number. Downside is the container name, thus the domain name will be refreshed every time you rebuild the container.

---

_[View the full topic](https://meta.discourse.org/t/developing-discourse-using-a-dev-container/336366)._
