
ECRログイン
AWS_REGION=ap-northeast-1 REPOSITORY_NAME=example-repo
# aws ecr create-repository --profile {IAM User名} --repository-name ${REPOSITORY_NAME} --region ${AWS_REGION}
{
"repository": {
"repositoryUri": "xxxxxx.dkr.ecr.ap-northeast-1.amazonaws.com/example-repo",
"registryId": "xxxxx",
"imageTagMutability": "MUTABLE",
"repositoryArn": "arn:aws:ecr:ap-northeast-1:xxxxx:repository/example-repo",
"repositoryName": "example-repo",
"createdAt": 1652431907.0
}
}
REGISTRY_ID=xxxxx
REGISTRY_LOGIN_URL=${REGISTRY_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com
ログイン
AWS CLI v2バージョン
# aws ecr get-login-password --profile {IAM User名} --region ap-northeast-1 | docker login --username AWS --password-stdin ${REGISTRY_LOGIN_URL}
AWS CLI v1バージョン
# $(aws ecr get-login --profile {IAM User名} --region ${AWS_REGION} --no-include-email)
ECRへDockerイメージをPush
ビルド
% docker build -t ${REGISTRY_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/${REPOSITORY_NAME}:latest .
ECRへプッシュ
% docker push ${REGISTRY_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/${REPOSITORY_NAME}:latest





