# 使用 Docker 托管时，不使用卷（或自动使用 S3）

**URL:** https://meta.discourse.org/t/not-using-volumes-or-automatically-using-s3-when-hosting-with-docker/258952
**Category:** Self-hosting
**Tags:** docker
**Created:** [2023年三月21日 19:56 UTC](https://meta.discourse.org/t/not-using-volumes-or-automatically-using-s3-when-hosting-with-docker/258952 "2023-03-21T19:56:16Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![milo123459](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/milo123459/32/298982_2.png) [@milo123459](https://meta.discourse.org/u/milo123459)
#### Post date: [2023年三月21日 19:56 UTC](https://meta.discourse.org/t/not-using-volumes-or-automatically-using-s3-when-hosting-with-docker/258952/1 "2023-03-21T19:56:16Z")

</div>

你好！有没有办法通过 Docker 镜像托管 Discourse 而不使用卷？我想知道是否有什么方法可以通过 compose 文件/docker 命令行挂载卷以自动链接到 S3。

---

<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: [2023年三月21日 21:29 UTC](https://meta.discourse.org/t/not-using-volumes-or-automatically-using-s3-when-hosting-with-docker/258952/2 "2023-03-21T21:29:12Z")

</div>

S3 是对象存储，而卷需要完整的文件系统，因此在 AWS 服务术语中，它们与 EFS 相当，而不是 S3。

话虽如此，通过根据 [为上传配置 S3 兼容对象存储提供商](https://meta.discourse.org/t/configure-an-s3-compatible-object-storage-provider-for-uploads/148916) 和 [配置 Discourse 使用单独的 PostgreSQL 服务器](https://meta.discourse.org/t/configure-discourse-to-use-a-separate-postgresql-server/46375) 来配置 Discourse，您可以获得一个基本无状态的 Discourse。将其置于 AWS ALB 后面进行 TLS 终止，并使用 AWS Elasticache 进行 Redis，您就实现了完全无状态。

---

<div class="post-metadata">

### Author: ![milo123459](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/milo123459/32/298982_2.png) [@milo123459](https://meta.discourse.org/u/milo123459)
#### Post date: [2023年三月22日 07:52 UTC](https://meta.discourse.org/t/not-using-volumes-or-automatically-using-s3-when-hosting-with-docker/258952/3 "2023-03-22T07:52:27Z")

</div>

您说“大部分无状态”，是指不需要卷（volumes）吗？我现在正尝试将 Discourse 部署到不支持卷的 [Railway](https://railway.app) 上。它支持 Postgres，理论上我也可以连接到 S3，但我不太确定该如何操作。不过，还是感谢您的信息！

---

<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: [2023年三月23日 00:41 UTC](https://meta.discourse.org/t/not-using-volumes-or-automatically-using-s3-when-hosting-with-docker/258952/4 "2023-03-23T00:41:04Z")

</div>

> [@milo123459](#):
>
> 当你说“大部分是无状态的”，你的意思是不需要卷吗？

是的。

> [@milo123459](#):
>
> 我现在正试图将 Discourse 部署到 [Railway](https://railway.app)

这样做需要对 Discourse、Redis、postgres、S3 和 SSL 终止有相当深入的了解。这里不支持这样做。

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2023年四月22日 00:41 UTC](https://meta.discourse.org/t/not-using-volumes-or-automatically-using-s3-when-hosting-with-docker/258952/5 "2023-04-22T00:41:08Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
