0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

DockerコンテナをECRで管理する方法

0
Posted at

はじめに

ECRとは、Amazon EC2 Container RegistryというAWSが管理するコンテナレジストリ。
同様のサービスでDocker Hubなどがある。

前提条件

  • aws-cliの最新バージョンがインストールされていること。
  • regionや認証情報が設定済みであること。

aws-cliがインストールされていない場合

# インストール
$ sudo pip install awscli

# 最新化
$ sudo pip install awscli --upgrade --ignore-installed six

認証情報が未設定の場合

$ aws configure

手順

ECRにリポジトリを作る

$ aws ecr create-repository --repository-name <コンテナ名>

{
    "repository": {
        "registryId": "XXXXXXXXXXXX", 
        "repositoryName": "<コンテナ名>", 
        "repositoryArn": "arn:aws:ecr:ap-northeast-1:XXXXXXXXXXXX:repository/<コンテナ名>", 
        "repositoryUri": "XXXXXXXXXXXX.dkr.ecr.ap-northeast-1.amazonaws.com/<コンテナ名>"
    }
}

上記の「repositoryUri」の値をメモしておく。

dockerイメージにタグをつける

$ docker tag <コンテナ名>:<タグ名> <上記でメモしたrepositoryUri>/<コンテナ名>:<タグ名>

ECRにログインする

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

ECRにプッシュする

$ docker push <上記でメモしたrepositoryUri>/<コンテナ名>:<タグ名>

参考サイト

0
2
0

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
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?