【发布时间】:2021-06-03 12:47:54
【问题描述】:
我正在尝试将具有多个服务的 docker 容器部署到 ECS。我一直在关注这篇看起来很棒的文章:https://aws.amazon.com/blogs/containers/deploy-applications-on-amazon-ecs-using-docker-compose/
我可以让我的容器在本地运行,并且可以使用 AWS CLI 连接到 ECS 上下文;但是在我运行时文章中的基本示例中
docker compose up
为了将镜像部署到 ECS,我收到错误:
pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
似乎无法对此做出正面或反面。我的 docker 使用
登录到 ECSaws ecr get-login-password --region region | docker login --username AWS --password-stdin aws_account_id.dkr.ecr.region.amazonaws.com
我的 aws CLI 上的默认 IAM 用户具有 AmazonECS_FullAccess 以及“ecs:ListAccountSettings”和“cloudformation:ListStackResources”
我在这里读到:pull access denied repository does not exist or may require docker loginmikemaccana 的回答是,在 2020 年 11 月之后,您的 YAML 文件中可能需要进行身份验证以允许 AWS 从 hub.docker.io 中提取(例如,给 aws 您的 Docker 中心用户名和密码),但我无法让 'auth' 语法在我的 yaml 文件中工作。这是我在本地运行 tomcat 和 mariadb 的 YAML 文件:
version: "2"
services:
database:
build:
context: ./tba-database
image: tba-database
# set default mysql root password, change as needed
environment:
MYSQL_ROOT_PASSWORD: password
# Expose port 3306 to host. Not for the application but
# handy to inspect the database from the host machine.
ports:
- "3306:3306"
restart: always
webserver:
build:
context: ./tba-webserver
image: tba-webserver
# mount point for application in tomcat
volumes:
- ./target/testPROJ:/usr/local/tomcat/webapps/ROOT
links:
- database:tba-database
# open ports for tomcat and remote debugging
ports:
- "8080:8080"
- "8000:8000"
restart: always
【问题讨论】:
标签: amazon-web-services docker docker-compose amazon-ecs