this is ubuntu 24 VPS. discourse already using 10gigs of ram. that’s not okay.
It seems like it build a docker run command. While this included
–shm-size=512m
I would prefer apply additional cpu and ram constraints as I don’t want it to suck up 4c12r since other dockers will live here. Can I simply copy the resultant command or is it stored somewhere. I plan to docker stop docker rm to inject
This is an answer supplied by ask.discourse.org. Please report on its usefulness.
1. Setting Persistent CPU & RAM Limits for Discourse Docker
When installing Discourse on a VPS via the official GitHub guide, resource limits like --memory and --cpus are not included by default. While you can manually add such flags to the Docker run command, any changes done directly with docker stop and a new docker run will be lost after running ./launcher rebuild app. The launcher script always recreates the container.
Recommended approaches:
a) Launcher Script Modification
To persistently enforce resource limits, you must modify the launcher script that Discourse uses to start Docker containers. For example, around line 289, adapt:
b) Editing the Docker Command Directly
While it’s technically possible to run Docker with custom limits by copying your rebuilt docker run command, this is not persistent and is not recommended.
There’s not yet an official, persistent “built-in” method to pass Docker --memory or --cpus args for Discourse’s standard deployment tooling, short of modifying the launcher.
2. Container Name
By default, Discourse’s launcher names the container app. You can confirm this with docker ps. Changing the container name would also require modifying the launcher or templates directly.
Read more: Discourse in a Docker container
If you’re looking for a more elegant and persistent way (like a template or supported launcher feature), check this related discussion: Switches for resource constrained VPS?