我在 DockerHub 镜像和 Azure 容器实例上设置速率限制时遇到了问题。我们公司提供 Docker 付费订阅,应该可以解决,但我没有密码,只有单点登录 (SSO)。
我该如何在 Terraform 中配置它?image_registry_credentials
我只看到server, username and password
一些字段,没有看到使用令牌等信息。
我浏览了文档,但找不到任何参考资料。在这里找到了一个针对 AKS 的解决方案,但似乎不适用。
我的地形块:
resource "azurerm_container_group" "clamav" {
depends_on = [ azurerm_virtual_network.vnet1 ]
name = "ci-${var.project}-${var.env}-${var.location}-001"
location = var.location
resource_group_name = var.rg
os_type = "Linux"
ip_address_type = "Private"
// avoid docker ratelimiting issues with paid subscription credentials
image_registry_credential {
server = "index.docker.io"
username = "myusername"
password = "what here??"
}
// official clamav image, listens at tcp 3310 inside container group, resolvable at localhost or "clamav"
container {
memory = "3" // source: https://docs.clamav.net/manual/Installing/Docker.html
cpu = "1"
name = "clamav"
image = "clamav/clamav:1.4.2" // avoid "latest" or "stable" to lock down a supported version
}
// sidecar: rest api that accepts multipart file requests at :3000/api/v1/scan, and scans them with clamav
container {
memory = "1"
cpu = "1"
name = "clamav-restapi"
image = "benzino77/clamav-rest-api:1.5.5"
ports {
port = 3000
protocol = "TCP"
}
environment_variables = {
"APP_PORT" : "3000"
"APP_FORM_KEY" : "FILES"
"APP_MAX_FILE_SIZE" : "10485760" // 10MB
"CLAMD_IP" : "localhost"
"CLAMD_PORT" : "3310"
}
}
subnet_ids = [azurerm_subnet.containers.id]
tags = local.tags
}