# 服务配置参考

Compose文件是一个yaml文件，可以以.yaml或yml文件扩展名结尾。Compose文件定义了服务(services)，网络（network）和卷（volume）。Compose文件的默认路径是./docker-compose.yml。

在一个服务的定义中包含的一些配置信息会被用于每一个容器的启动。特别像传递命令行参数给docker run命令。网络和卷的定义类似于docker volume create和docker network create。

与docker run一样，Dockerfile中指定的选项（如 CMD、EXPOSE、VOLUME、ENV）默认受到关注。 我们不需要在docker-compose.yml中再次指定它们。

在配置Compose文件时，可以使用变量替换来引用变量中的值。使用像bash那样的语法：${VARIABLE}。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://camelgemonion.gitbook.io/docker/dockercompose.yaml-wen-jian-zhong-chang-yong-zhi-ling/untitled-12.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
