> For the complete documentation index, see [llms.txt](https://camelgemonion.gitbook.io/docker/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://camelgemonion.gitbook.io/docker/dockercompose.yaml-wen-jian-zhong-chang-yong-zhi-ling/untitled-12/untitled-7/duan-yu-fa-xing-shi.md).

# 短语法形式

短语法形式只指定config名称，它可以为容器授权，使其可以访问config并将它挂载到容器内部的/config\_name上。源名称和目标挂载点的名称都被设置成config的名称。

下面的示例使用短语法形式来授权redis服务访问my\_config和my\_other\_config的配置。my\_config的值被设置成文件./my\_config.txt的内容，而my\_other\_config定义为一个外部资源，这意味该资源已经在docker中被定义。可以通过docker config create命令或者通过其他的stack部署来定义。如果外部资源不存在，则stack deployment以config not found的错误消息表示部署失败。

Note:

config定义只支持3.3或更高的compose文件版本

```
 version: "3.8"
 services:
   redis:
     image: redis:latest
     deploy:
       replicas: 1
     configs:
       - my_config
       - my_other_config
 configs:
   my_config:
     file: ./my_config.txt
   my_other_config:
     external: true
```
