This commit is contained in:
@@ -1,23 +0,0 @@
|
|||||||
# Docker Compose: 限制容器的资源使用
|
|
||||||
|
|
||||||
## 修改 docker-compose.yml
|
|
||||||
|
|
||||||
运用 compose 组件可限制容器的资源使用,以下是示例 docker-compose.yml
|
|
||||||
|
|
||||||
``` yaml title="docker-compose.yml"
|
|
||||||
services:
|
|
||||||
<service_name>:
|
|
||||||
image: <image_path>
|
|
||||||
## 可用的 CPU 数
|
|
||||||
cpus: 1
|
|
||||||
## 内存大小限制
|
|
||||||
mem_limit: 1G
|
|
||||||
```
|
|
||||||
|
|
||||||
在以上示例中,容器的 CPU 使用数限制在1个,内存使用限制在1G。
|
|
||||||
|
|
||||||
## 参考
|
|
||||||
|
|
||||||
[如何在 docker compose file 中限制系統資源的使用 - Zen's Blog](https://www.zenwen.tw/docker-compose-file-limit-resource)
|
|
||||||
|
|
||||||
[Define services in Docker Compose - Docker Docs](https://docs.docker.com/reference/compose-file/services)
|
|
||||||
@@ -103,3 +103,25 @@ D:\esptool-v5.2.0-windows-amd64\esptool.exe --chip esp32s3 --port [ESP32-S3 设
|
|||||||
```
|
```
|
||||||
|
|
||||||
显示 `Flash memory erased successfully` 后,你就可以像对待一块全新的 ESP32-S3 一样,用常规方法刷写任何其他固件了。
|
显示 `Flash memory erased successfully` 后,你就可以像对待一块全新的 ESP32-S3 一样,用常规方法刷写任何其他固件了。
|
||||||
|
|
||||||
|
## Docker Compose 限制容器的资源使用
|
||||||
|
|
||||||
|
运用 compose 组件可限制容器的资源使用,以下是示例:
|
||||||
|
|
||||||
|
``` yaml title="docker-compose.yml"
|
||||||
|
services:
|
||||||
|
<service_name>:
|
||||||
|
image: <image_path>
|
||||||
|
# 可用的 CPU 数
|
||||||
|
cpus: 1
|
||||||
|
# 内存大小限制
|
||||||
|
mem_limit: 1G
|
||||||
|
```
|
||||||
|
|
||||||
|
在以上示例中,容器的 CPU 使用数限制在1个,内存使用限制在1G。
|
||||||
|
|
||||||
|
### 参考
|
||||||
|
|
||||||
|
[如何在 docker compose file 中限制系統資源的使用 - Zen's Blog](https://www.zenwen.tw/docker-compose-file-limit-resource)
|
||||||
|
|
||||||
|
[Define services in Docker Compose - Docker Docs](https://docs.docker.com/reference/compose-file/services)
|
||||||
@@ -101,7 +101,6 @@ nav:
|
|||||||
- "手把手教你备份和还原 Docker 卷": tech/Backup-and-Restore-of-Docker-Volumes-A-Step-by-Step-Guide.md
|
- "手把手教你备份和还原 Docker 卷": tech/Backup-and-Restore-of-Docker-Volumes-A-Step-by-Step-Guide.md
|
||||||
- "在 Ubuntu 24.04 上添加交换空间": tech/How-to-Add-Swap-Space-on-Ubuntu-2404.md
|
- "在 Ubuntu 24.04 上添加交换空间": tech/How-to-Add-Swap-Space-on-Ubuntu-2404.md
|
||||||
- "安装和配置 Material for MkDocs": tech/Install-Material-for-MkDocs.md
|
- "安装和配置 Material for MkDocs": tech/Install-Material-for-MkDocs.md
|
||||||
- "Docker Compose: 限制容器的资源使用": tech/Docker-Compose-Limiting-container-resource-usage.md
|
|
||||||
- "Authentik: 搭建属于自己的单点登录服务": tech/Build-Your-Own-SSO.md
|
- "Authentik: 搭建属于自己的单点登录服务": tech/Build-Your-Own-SSO.md
|
||||||
- "创建和管理 Linux 服务器用于身份验证的 SSH 密钥": tech/Creating-and-Managing-SSH-Keys-for-Authentication-on-Linux-Servers.md
|
- "创建和管理 Linux 服务器用于身份验证的 SSH 密钥": tech/Creating-and-Managing-SSH-Keys-for-Authentication-on-Linux-Servers.md
|
||||||
- "将已经失效的 Onedrive 账户从资源管理器边侧栏去除": tech/Remove-deactivated-Onedrive-accounts-from-Explorer-sidebar.md
|
- "将已经失效的 Onedrive 账户从资源管理器边侧栏去除": tech/Remove-deactivated-Onedrive-accounts-from-Explorer-sidebar.md
|
||||||
|
|||||||
Reference in New Issue
Block a user