更新description

This commit is contained in:
huty 2024-05-17 09:00:00 +00:00 committed by cloud-init created default user
parent b1730577d5
commit b73249c50b

View File

@ -1,50 +1,105 @@
# 指定API版本号
version: "3.9" version: "3.9"
# 指定文件名称
name: ${NAME}
# 服务相关
services: services:
## 服务1
${SERVICE_NAME}: ${SERVICE_NAME}:
### 镜像
image: ${IMAGE_NAME}:${IMAGE_TAG} image: ${IMAGE_NAME}:${IMAGE_TAG}
### 容器名称
container_name: ${CONTAINER_NAME} container_name: ${CONTAINER_NAME}
### 重启规则
restart: on-failure:3 restart: on-failure:3
### 是否以特权模式启动容器
privileged: true privileged: true
### 容器内用户
user: ${USER_NAME}:${USER_GROUP} user: ${USER_NAME}:${USER_GROUP}
### 容器内工作目录
working_dir: ${WORKING_DIR} working_dir: ${WORKING_DIR}
### 挂载的存储卷或目录
volumes: volumes:
#### 确保容器内时间和主机一致
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
#### 挂载存储卷需在volumes部分设置卷相关参数
- ${VOLUME_NAME}:${CONTAINER_PATH} - ${VOLUME_NAME}:${CONTAINER_PATH}
#### 挂载主机目录
- ${HOST_PATH}:${CONTAINER_PATH} - ${HOST_PATH}:${CONTAINER_PATH}
### 使用的配置需在configs部分设置配置相关参数
configs: configs:
- ${CONFIG_NAME} - ${CONFIG_NAME}
### 使用的凭据需在secrets部分设置凭据相关参数
secrets: secrets:
- ${SECRET_NAME} - ${SECRET_NAME}
### 容器内环境变量
environment: environment:
- ${KEY}=${VALUE} - ${KEY}=${VALUE}
### 运行容器时执行的命令
command: ${COMMAND} command: ${COMMAND}
### 当前服务依赖的容器
depends_on: depends_on:
- ${SERVICE_NAME} - ${SERVICE_NAME}
### 容器的网络模式
network_mode: host network_mode: host
### 容器的端口号
ports: ports:
- ${HOST_PORT}:${CONTAINER_PORT} - ${HOST_PORT}:${CONTAINER_PORT}
### 容器的网络
networks: networks:
- ${NETWORK_NAME} - ${NETWORK_NAME}
# 存储卷相关
volumes: volumes:
## 存储卷1
${VOLUME_NAME}: ${VOLUME_NAME}:
external: true ## 存储卷名称
name: ${VOLUME_NAME} name: ${VOLUME_NAME}
## 是否使用已存在的存储卷
configs:
${CONFIG_NAME}:
external: true external: true
# 配置相关
configs:
## 配置1
${CONFIG_NAME}:
### 配置名称
name: ${CONFIG_NAME} name: ${CONFIG_NAME}
### 是否使用已存在的配置
external: true
### 配置对应的文件
file: ${CONFIG_FILE_NAME} file: ${CONFIG_FILE_NAME}
# 凭据相关
secrets: secrets:
## 凭据1
${SECRET_NAME}: ${SECRET_NAME}:
external: true ### 凭据名称
name: ${SECRET_NAME} name: ${SECRET_NAME}
file: ${SECRET_FILE_NAME} ### 是否使用已存在的凭据
networks:
${NETWORK_NAME}:
external: true external: true
### 凭据对应的文件
file: ${SECRddET_FILE_NAME}
# 网络相关
networks:
## 网络1
${NETWORK_NAME}:
## 网络名称
name: ${NETWORK_NAME} name: ${NETWORK_NAME}
## 是否使用已存在的网络
external: true
## 网络适配器
driver: bridge
## 网络适配器参数
driver_opts:
### 是否加密
encrypted: 'true'
## 网络参数
ipam:
### 适配器
driver: default
### 配置
config:
#### 网段
- subnet: 172.21.0.1/24