我的问题
我已经使用来自 Dockerhub 的默认 Redis 映像在 AWS 上成功部署了一个带有几十个 Redis Docker 容器的游牧作业。
我稍微更改了创建的默认配置文件nomad init
以更改正在运行的容器的数量,并且一切都按预期工作
问题是我想运行的实际图像在ECR中,这需要 AWS 权限(访问和密钥),我不知道如何发送这些。
代码
job "example" {
datacenters = ["dc1"]
type = "service"
update {
max_parallel = 1
min_healthy_time = "10s"
healthy_deadline = "3m"
auto_revert = false
canary = 0
}
group "cache" {
count = 30
restart {
attempts = 10
interval = "5m"
delay = "25s"
mode = "delay"
}
ephemeral_disk {
size = 300
}
task "redis" {
driver = "docker"
config {
# My problem here
image = "https://-whatever-.dkr.ecr.us-east-1.amazonaws.com/-whatever-"
port_map {
db = 6379
}
}
resources {
network {
mbits = 10
port "db" {}
}
}
service {
name = "global-redis-check"
tags = ["global", "cache"]
port = "db"
check {
name = "alive"
type = "tcp"
interval = "10s"
timeout = "2s"
}
}
}
}
}
我试过什么
- 广泛的谷歌搜索
- 阅读手册
- 将
aws
凭据放置在运行 nomad 文件的机器中(使用aws configure
)
我的问题
如何配置 nomad 以使用 AWS 凭证从 AWS ECR 中提取 Docker 容器?