ども、かっぱです。
YOKOSO 東京へ
待ちにまった ECR が東京リージョンで利用出来るようになったのでメモ。
うんちくは割愛、CLI のチートみたいな感じで。
ちなみに、今までの ECR 遍歴については本ブログの ECR カテゴリをご覧くさい。
memo
試した環境
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.11.6
BuildVersion: 15G31
$ aws --version
aws-cli/1.10.41 Python/2.7.10 Darwin/15.6.0 botocore/1.4.31
docker login する為のトークンを取得
- run
$ aws --region ap-northeast-1 ecr get-login
- output
docker login -u AWS -p xxx -e none https://xxxxxxxxxxxx.dkr.ecr.ap-northeast-1.amazonaws.com
ECR にログインする
- run
$ docker login -u AWS -p xxx -e none https://xxxxxxxxxxxx.dkr.ecr.ap-northeast-1.amazonaws.com
- output
WARNING: login credentials saved in /Users/xxxxx/.docker/config.json
Login Succeeded
- run / output
$ cat ~/.docker/config.json { "auths": { "https://xxxxxxxxxxxx.dkr.ecr.ap-northeast-1.amazonaws.com": { "auth": "yyyy", "email": "none" }, "https://xxxxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com": { "auth": "xxxx", "email": "none" } } }
ECR にリポジトリを作成
- run
$ aws --region ap-northeast-1 ecr create-repository --repository-name oreno-image
- output
{ "repository": { "registryId": "xxxxxxxxxxxx", "repositoryName": "oreno-image", "repositoryArn": "arn:aws:ecr:ap-northeast-1:xxxxxxxxxxxx:repository/oreno-image", "repositoryUri": "xxxxxxxxxxxx.dkr.ecr.ap-northeast-1.amazonaws.com/oreno-image" } }
タグ付けからの docker push
- run
$ docker tag busybox xxxxxxxxxxxx.dkr.ecr.ap-northeast-1.amazonaws.com/oreno-image $ docker push xxxxxxxxxxxx.dkr.ecr.ap-northeast-1.amazonaws.com/oreno-image
- output
The push refers to a repository [xxxxxxxxxxxx.dkr.ecr.ap-northeast-1.amazonaws.com/oreno-image] 5f70bf18a086: Pushed 1834950e52ce: Pushed latest: digest: sha256:xxx size: 1920
ECR 上のリポジトリを確認
- run
$ aws --region ap-northeast-1 ecr describe-repositories
- output
{ "repositories": [ { "registryId": "xxxxxxxxxxxx", "repositoryName": "oreno-image", "repositoryArn": "arn:aws:ecr:ap-northeast-1:xxxxxxxxxxxx:repository/oreno-image", "repositoryUri": "xxxxxxxxxxxx.dkr.ecr.ap-northeast-1.amazonaws.com/oreno-image" } ] }
リポジトリ上のイメージを確認
- run
$ aws --region ap-northeast-1 ecr list-images --repository-name oreno-image
- output
{ "imageIds": [ { "imageTag": "latest", "imageDigest": "sha256:xxx" } ] }
以上
メモでした。