Setting up GCR / ECR the First Time
There's a lot of great docs out there on container registries, but sometimes they're too exhaustive. Here's the boiled down summary for GCR and ECR setup.
GCR Setup
On google cloud go to Container Registry on the left hand menu and enable it, you should see something like:
Now ensure you have google cloud client installed here: cloud.google.com/sdk/docs/install
Let's get a container uploaded assuming our project is cloudregistry-123
$ docker pull gcr.io/google-samples/hello-app:1.0
$ gcloud auth configure-docker
$ docker tag gcr.io/google-samples/hello-app:1.0 gcr.io/cloudregistry-123/quickstart-image:tag1
$ docker push gcr.io/cloudregistry-123/quickstart-image:tag1
You'll should now see the following:
Clicking into it gives:
ECR Setup
Amazon ECR doesn't use the phrase images
but calls them repositories
so the hello-world would be its own repository inside your registry, so you'll see below the additional create-repository
step (which in google cloud creation of images is done implicitly on docker push
).
Let's start as follows:
Now let's get the hello world image uploaded assuming our registry is 123.dkr.ecr.us-east-1.amazonaws.com
$ docker login -u AWS -p $(aws ecr get-login-password --region us-east-1) 123.dkr.ecr.us-east-1.amazonaws.com
$ docker tag gcr.io/google-samples/hello-app:1.0 123.dkr.ecr.us-east-1.amazonaws.com/quickstart-image:tag1
$ aws ecr create-repository --repository-name quickstart-image
$ docker push 123.dkr.ecr.us-east-1.amazonaws.com/quickstart-image:tag1
Note: For simplicity it may be okay to push the latest tag if you'd like to.