LoginSignup
43

More than 5 years have passed since last update.

Amazon ECR使い方簡易版

Last updated at Posted at 2015-12-22

追記

東京リージョンリリースされたので、追記
s/us-east-1/ap-northeast-1/g

リポジトリ作成

リポジトリ作るAPI調べる前に手で作っちゃった。下記ページでとりあえず、create repositryしちゃう。
https://console.aws.amazon.com/ecs/home?region=ap-northeast-1#/repositories

IAMで権限設定

IAMで権限降ってね AmazonEC2ContainerRegistryFullAccess

awscliをアップデート

% pip install --upgrade awscli

docker-login

docker-pushの時にログインを促されるから事前にやっとく

% $(aws ecr get-login --region ap-northeast-1)

configファイルをからリポジトリ確認しましょう。

% cat ~/.docker/config.json
{
        "auths": {
                "https://1234567890.dkr.ecr.ap-northeast-1.amazonaws.com": {   <= これな!

あとはdocker-build & push!

# ECR_REPOSしっかり確認
export ECR_REPOS=1234567890.dkr.ecr.ap-northeast-1.amazonaws.com
export REPOS_NAME=my-app:latest
docker build -t $ECR_REPOS/$REPOS_NAME .
docker push $ECR_REPOS/$REPOS_NAME

メモ

こういうのが出たら、認証キーの有効期限が切れてるかも。

Error pushing to registry: Server error: unexpected 403 response status trying to initiate upload of ur-app

もっかいログインすればOK

$(aws ecr get-login --region ap-northeast-1)

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
43