# How to start discourse inside a linux container?

**URL:** https://meta.discourse.org/t/how-to-start-discourse-inside-a-linux-container/79757
**Category:** Self-hosting
**Tags:** unsupported-install
**Created:** [February 4, 2018, 1:38pm UTC](https://meta.discourse.org/t/how-to-start-discourse-inside-a-linux-container/79757 "2018-02-04T13:38:57Z")
**Posts on this page:** 1
**Showing post:** 12

<div class="post-metadata">

### Author: ![balupton](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/balupton/32/255461_2.png) [@balupton](https://meta.discourse.org/u/balupton)
#### Post date: [February 7, 2024, 1:41am UTC](https://meta.discourse.org/t/how-to-start-discourse-inside-a-linux-container/79757/12 "2024-02-07T01:41:32Z")

</div>

I tried getting discourse going inside lxd on ubuntu server on a raspberry pi 4 with a usb ssd, and it would just hang and timeout during rebuilds, the hanging was worse/earlier using a btrfs loopback storage pool and later using a zfs loopback storage pool. Memory was consistent around 1gb with 3gb peaks. The hangs would have ssh/top be responsibe but all usage activity would drop to negligible, indicating it had given up.

These days [the lxd docs](https://documentation.ubuntu.com/lxd/en/latest/faq/#how-can-i-run-docker-inside-a-lxd-container) just recommend setting security.nesting to the string value true to enable docker usage, which is what I did. However the lxd docs also [has a page for production configuration](https://documentation.ubuntu.com/lxd/en/latest/explanation/performance_tuning/) with about 20 settings that need changing, which I haven’t tried.

In the end I gave up on my lxd attempt for discourse, and just ran discourse via docker on the same machine.

Details of my efforts here:

> [@An ordeal migrating from Scaleway to a Raspberry Pi 4](https://meta.discourse.org/t/an-ordeal-migrating-from-scaleway-to-a-raspberry-pi-4/294354):
>
> Here the documentation of my mishaps and my eventual success getting a discourse instance migrated from scaleway to a raspberry pi 4, with cloudflare infront. Created a backup from the scaleway discourse instance, and ./launcher stop app, and shutted down the machine. Installed Ubuntu Server 23.10 on a usb connected sata ssd powering the Raspberry Pi 4 Installed LXD, created a 100GiB btfs loopback storage pool. Update the default profile to: config: cloud-init.user-data: | #cloud-conf…

Strangely the below lxd docker guide recommends btrfs despite [the lxd docs recommending against it](https://documentation.ubuntu.com/lxd/en/latest/reference/storage_btrfs/#storage-btrfs), and does not appear to use a partition for it (yet they set some extra settings, install other packages rather than [docker.io](http://docker.io), and attach the btrfs volume only to docker), so I wonder why I had such issues:

> **[How to run Docker inside LXD containers](https://discourse.ubuntu.com/t/how-to-run-docker-inside-lxd-containers/26730?u=balupton)**
>
> Key Value Summary Learn how to run Docker inside of LXD Containers. Categories containers Difficulty 3 Author Miona Aleksic miona.aleksic@canonical.com Overview Duration: 1:00 LXD and Docker containers serve different purposes. LXD...

@vmsman can you share more details about your lxd setup, such as profiles, storage pools, and any system settings that needed changes, as seems you’ve had the most successful setup so far:

> [@Update from 3.0.0.beta16 to 3.1.0.beta2](https://meta.discourse.org/t/update-from-3-0-0-beta16-to-3-1-0-beta2/257663/8):
>
> My installation of Discourse is very generic. After a reboot I got a clean backup. So, ultimately I decided to do a from scratch installation. The installation failed with the same errors I posted above. I have been running Discourse with 6GB of memory in a LXD container the past four years with no issues. The memory utilization is steady at 1.9GB. During an upgrade, the memory peaks out at 5.1GB. My database backup is only 30GB of data and so my installation is small as compared with ot…

For lxd, some things I wonder about:

- whether partitions for storage pools instead of loopback files would solve the performance issues enough the hanging issues goes away
- whether using microcloud or an lxd cluster would help, or using ceph as the storage pool

All in all, despite not getting discourse working in lxd, I am very impressed with lxd and its easy of use. I previously spent months struggling with hashicorp, as hashicorp only seems interested in enterprise use cases. Whereas lxd just works and people seem supportive enough to enable small teams and indie devs to make progress.

---

_[View the full topic](https://meta.discourse.org/t/how-to-start-discourse-inside-a-linux-container/79757)._
