我正在尝试通过图像定义文件更新现有容器中的环境变量。
image definition.json
{
"taskDefinition": {
"family": "testrepository",
"containerDefinitions": [
{
"name": "testrepository",
"image": "046940809212.dkr.ecr.us-east2.amazonaws.com/testrepository",
"environment":[
{"name":"AW_API_KEY","value":"7265376200510qo25cgkv0pfa086fvc158of76no8m74. apps.googleusercontent.com"},
{"name":"AW_API_SECRET" ,"value":"n0mw1g7Yri70-oMrJ4zd9T3h"}
],
"portMappings": [
{
"protocol": "tcp",
"containerPort": 80,
"hostPort": 80
}
]
}
],
"cpu": 100,
"memory": 128,
"essential": false
}
}
我正在尝试通过buildspec.yml文件进行更新。
我的buildspec.yml
post_build:
commands:
- echo Build completed on
日期
- echo Pushing the Docker images...
- docker push $REPOSITORY_URI:latest
- docker push $REPOSITORY_URI:$IMAGE_TAG
- printf '[{"name":"testrepository","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
artifacts:
files: imagedefinitions.json
注意:运行任务时,使用默认的空白值可以成功,但我没有收到任何错误消息。