# Web-only - do I need a separate image for each container?

**URL:** https://meta.discourse.org/t/web-only-do-i-need-a-separate-image-for-each-container/294549
**Category:** Self-hosting
**Created:** [February 7, 2024, 2:51pm UTC](https://meta.discourse.org/t/web-only-do-i-need-a-separate-image-for-each-container/294549 "2024-02-07T14:51:54Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![lejeczek](https://avatars.discourse-cdn.com/v4/letter/l/edb3f5/32.png) [@lejeczek](https://meta.discourse.org/u/lejeczek)
#### Post date: [February 7, 2024, 2:51pm UTC](https://meta.discourse.org/t/web-only-do-i-need-a-separate-image-for-each-container/294549/1 "2024-02-07T14:51:54Z")

</div>

Hi guys.

Something trivial I thought but I failed to find a clear answer, thus asking here.

With a **web-only** containers - how to make & use one image which such containers would/should share?

That surely must make sense - such “thin” discourse container with everything outside (particularly on poor man budget on XS vmses) each having it’s own docker image is… makes no sense in my mind, right?

I hope I’m missing some “obvious” doc/howto on such simple (& common/popular?) scenario?  
many thanks.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 7, 2024, 6:54pm UTC](https://meta.discourse.org/t/web-only-do-i-need-a-separate-image-for-each-container/294549/2 "2024-02-07T18:54:57Z")

</div>

Yes, you can use the single postgres for multiple Discourse sites, but unless you’re going to use multisite (see [Multisite configuration with Docker](https://meta.discourse.org/t/multisite-configuration-with-docker/14084)), each needs its own redis.

You’d need to create another database, and configure the second web container to use that one instead o fth eone named Discourse.

---

<div class="post-metadata">

### Author: ![lejeczek](https://avatars.discourse-cdn.com/v4/letter/l/edb3f5/32.png) [@lejeczek](https://meta.discourse.org/u/lejeczek)
#### Post date: [February 7, 2024, 7:17pm UTC](https://meta.discourse.org/t/web-only-do-i-need-a-separate-image-for-each-container/294549/3 "2024-02-07T19:17:18Z")

</div>

Thanks for taking time, for trying, however.. it’s not what I’m asking.  
I’ll try again, pardon me if I fail.. again  
When I:  
 → $ ./launcher bootstrap a.forum.xyz # or similar  
then process creates:

```plaintext
-> $ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
local_discourse/a.forum.xyz latest d7a7b6509811 2 hours ago 4.19GB

```

and that happens with each & every _launcher_ ran for a different/new forum.  
So I end up with multiple image of the same **discourse** - is it only me & result should be different?  
If not just me & that is desired & expected result, then that is - sure I am not devel and have no knowledge of the process(es) involved - rather really extremely wasteful (perhaps particularly with **web-only** container) - no?

What I was hoping for - when first tried discourse - what I expected was, pretty much what everything else, every other software which is _dockerized_ does, namely - get that one image and run many containers off it. Is **discourse** not cap/able of doing that?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 7, 2024, 7:54pm UTC](https://meta.discourse.org/t/web-only-do-i-need-a-separate-image-for-each-container/294549/4 "2024-02-07T19:54:16Z")

</div>

If you want to use the same container with different settings for different sites you can

./launcher start-cmd

To get the parameters to start it. You can change them for the other sites you want to run. You’ll still need a database and a redis for each.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [February 7, 2024, 9:07pm UTC](https://meta.discourse.org/t/web-only-do-i-need-a-separate-image-for-each-container/294549/5 "2024-02-07T21:07:56Z")

</div>

> [@lejeczek](#):
>
> So I end up with multiple image of the same **discourse** - is it only me & result should be different?

It contains unique copies of your sites themes, which include JS, CSS and other types of assets.

Also the unique combination of your plugins and their dependencies.

> [@lejeczek](#):
>
> What I was hoping for - when first tried discourse - what I expected was, pretty much what everything else, every other software which is _dockerized_ does, namely - get that one image and run many containers off it. Is **discourse** not cap/able of doing that?

It’s a long history, but Discourse and most of the tooling predates stuff like Docker compose.

We ship a fat container that contains the whole kitchen sink, and there are several trade-offs to that. As for one, the stateful container allows for features like our web based one-click updater.

Coming from a more modern approach to how containers are usually deployed today, it is indeed a big discrepancy. This is discussed at long in [Can Discourse ship frequent Docker images that do not need to be bootstrapped?](https://meta.discourse.org/t/can-discourse-ship-frequent-docker-images-that-do-not-need-to-be-bootstrapped/33205) and is worth a read.

In the end, our current status quo works well for people who are only slightly tech-inclined, that can copy and paste commands in a SSH session and configure DNS, but aren’t masters of Linux containers.

And as for the Linux containers black-belts out there, we can tell then that they can take that bootstrapped image, ship it to a registry and re-use it on their favorite container orchestration software.

People between the two personas above tho, they feel the pain the most.

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [February 7, 2024, 9:51pm UTC](https://meta.discourse.org/t/web-only-do-i-need-a-separate-image-for-each-container/294549/6 "2024-02-07T21:51:28Z")

</div>

> [@pfaffman](#):
>
> Yes, you can use the single postgres for multiple Discourse sites, but unless you’re going to use multisite (see [Multisite configuration with Docker](https://meta.discourse.org/t/multisite-configuration-with-docker/14084)), each needs its own redis.

I did not find an explanation on how to use one Redis for multiple instances in that how-to, but this seems to work out of the box when multisite configuration is available?

> [@Multiple discourse on a single redis host](https://meta.discourse.org/t/multiple-discourse-on-a-single-redis-host/219318/2):
>
> If you run Discourse in a multisite configuration, then we automatically add a site-specific prefix to all keys and pub-sub channels. That same prefixing is not available for standard ‘single site’ installations.

Do I understand correctly ?  
a) Multisite runs the same docker-image for multiple forums, using one redis and one postgres server.  
b) Using one redis for multiple discourse instances (using the same image or not) is not possible, since without turning multisite on, no prefix will be added to the redis keys.  
c) There is no other way to enforce a redis key prefix.  
d) Enforcing different redis key prefixes for different discourse images would allow using one redis server.  
e) General support for enforcing a general redis prefix would need several core changes.
