Amazon S3 快取

可用性: 實驗性

s3 快取儲存將生成的構建快取上傳到 Amazon S3 檔案儲存服務或其他 S3 相容服務,如 MinIO

預設的 docker 驅動程式不支援此快取儲存後端。要使用此功能,請使用不同的驅動程式建立新的構建器。有關更多資訊,請參閱構建驅動程式

概要

$ docker buildx build --push -t <user>/<image> \
  --cache-to type=s3,region=<region>,bucket=<bucket>,name=<cache-image>[,parameters...] \
  --cache-from type=s3,region=<region>,bucket=<bucket>,name=<cache-image> .

下表描述了您可以傳遞給 --cache-to--cache-from 的可用 CSV 引數。

名稱選項型別預設值描述
地區cache-to,cache-from字串必需。地理位置。
cache-to,cache-from字串必需。S3 桶的名稱。
namecache-to,cache-from字串快取映象的名稱。
endpoint_urlcache-to,cache-from字串S3 桶的端點。
blobs_prefixcache-to,cache-from字串要新增到 blob 檔名字首。
upload_parallelismcache-to整數4並行層上傳的數量。
touch_refreshcache-to時間24 小時更新未更改快取層時間戳的間隔。
manifests_prefixcache-to,cache-from字串要新增到清單檔名字首。
use_path_stylecache-to,cache-from布林值false當為 true 時,在 URL 中使用 bucket 而不是主機名。
access_key_idcache-to,cache-from字串請參閱身份驗證
secret_access_keycache-to,cache-from字串請參閱身份驗證
session_tokencache-to,cache-from字串請參閱身份驗證
modecache-tomin,maxmin要匯出的快取層,請參閱 快取模式
ignore-errorcache-to布林值false忽略因快取匯出失敗導致的錯誤。

身份驗證

Buildx 可以重用現有的 AWS 憑據(透過憑據檔案或環境變數配置),用於向 S3 推送和拉取快取。或者,您可以使用 access_key_idsecret_access_keysession_token 屬性直接在 CLI 上指定憑據。

有關使用環境變數和憑據檔案進行身份驗證的詳細資訊,請參閱 AWS Go SDK,指定憑據

進一步閱讀

有關快取的介紹,請參閱 Docker 構建快取

有關 s3 快取後端的更多資訊,請參閱 BuildKit README