# extra\_hosts

添加主机名映射。使用和docker客户端 --add-host选项一样的参数。

```
 extra_hosts:
   - "somehost:162.242.195.82"
   - "otherhost:50.31.209.229"
```

上面的示例会在服务的容器内部，/etc/hosts文件中创建一条主机名和IP地址记录。

```
 162.242.195.82  somehost
 50.31.209.229   otherhost
```


---

# 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/extra_hosts.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.
