> For the complete documentation index, see [llms.txt](https://philipzheng.gitbook.io/docker_practice/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://philipzheng.gitbook.io/docker_practice/repository/config.md).

# 設定檔案

Docker 的 Registry 利用設定檔案提供了一些倉庫的模組（flavor），使用者可以直接使用它們來進行開發或生產部署。

## 模組

在 `config_sample.yml` 檔案中，可以看到一些現成的模組段：

* `common`：基礎設定
* `local`：儲存資料到本地檔案系統
* `s3`：儲存資料到 AWS S3 中
* `dev`：使用 `local` 模組的基本設定
* `test`：單元測試使用
* `prod`：生產環境設定（基本上跟s3設定類似）
* `gcs`：儲存資料到 Google 的雲端
* `swift`：儲存資料到 OpenStack Swift 服務
* `glance`：儲存資料到 OpenStack Glance 服務，本地檔案系統為後備
* `glance-swift`：儲存資料到 OpenStack Glance 服務，Swift 為後備
* `elliptics`：儲存資料到 Elliptics key/value 儲存

使用者也可以新增自訂的模版段。

預設情況下使用的模組是 `dev`，要使用某個模組作為預設值，可以新增 `SETTINGS_FLAVOR` 到環境變數中，例如

```bash
export SETTINGS_FLAVOR=dev
```

另外，設定檔案中支援從環境變數中載入值，語法格式為 `_env:VARIABLENAME[:DEFAULT]`。

## 範例設定

```
common:
    loglevel: info
    search_backend: "_env:SEARCH_BACKEND:"
    sqlalchemy_index_database:
        "_env:SQLALCHEMY_INDEX_DATABASE:sqlite:////tmp/docker-registry.db"

prod:
    loglevel: warn
    storage: s3
    s3_access_key: _env:AWS_S3_ACCESS_KEY
    s3_secret_key: _env:AWS_S3_SECRET_KEY
    s3_bucket: _env:AWS_S3_BUCKET
    boto_bucket: _env:AWS_S3_BUCKET
    storage_path: /srv/docker
    smtp_host: localhost
    from_addr: docker@myself.com
    to_addr: my@myself.com

dev:
    loglevel: debug
    storage: local
    storage_path: /home/myself/docker

test:
    storage: local
    storage_path: /tmp/tmpdockertmp
```

## 選項


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://philipzheng.gitbook.io/docker_practice/repository/config.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
