Azure Blob 存储缓存

实验性

这是一个实验性功能。接口和行为不稳定,可能在未来的版本中发生变化。

azblob 缓存存储将您生成的构建缓存上传到 Azure的blob存储服务.

默认的docker驱动程序不支持此缓存存储后端。 要使用此功能,请使用不同的驱动程序创建一个新的构建器。有关更多信息,请参阅 构建驱动程序

概要

$ docker buildx build --push -t <registry>/<image> \
  --cache-to type=azblob,name=<cache-image>[,parameters...] \
  --cache-from type=azblob,name=<cache-image>[,parameters...] .

下表描述了可以传递给--cache-to--cache-from的可用CSV参数。

NameOptionTypeDefaultDescription
namecache-to,cache-fromStringRequired. The name of the cache image.
account_urlcache-to,cache-fromStringBase URL of the storage account.
secret_access_keycache-to,cache-fromStringBlob storage account key, see authentication.
modecache-tomin,maxminCache layers to export, see cache mode.
ignore-errorcache-toBooleanfalseIgnore errors caused by failed cache exports.

认证

如果未指定secret_access_key,则会根据Azure Go SDK的方案从BuildKit服务器的环境变量中读取。环境变量是从服务器读取的,而不是从Buildx客户端读取的。

进一步阅读

有关缓存的介绍,请参见 Docker 构建缓存

有关azblob缓存后端的更多信息,请参阅 BuildKit README