|
| 1 | +# Pushing Public Docker Images to Private ECR |
| 2 | + |
| 3 | +We will go through how to push a public docker image to a private repository in Elastic Container Registry. |
| 4 | + |
| 5 | +## Part 1: Pull a Docker image |
| 6 | + |
| 7 | +* In AWS console, In a notebook instance, Open JupyterLab: |
| 8 | + |
| 9 | +  |
| 10 | + |
| 11 | +* Open Terminal: |
| 12 | + |
| 13 | +  |
| 14 | + |
| 15 | +* Pull a Docker iamge: `docker pull public.ecr.aws/v8e3m3v4/sagemaker-studio/r:latest` |
| 16 | + |
| 17 | +  |
| 18 | + |
| 19 | +## Part 2: Create a repository in ECR |
| 20 | + |
| 21 | +* In AWS console, type *ECR* in search bar and then click **Elastic Container Registry**: |
| 22 | + |
| 23 | +  |
| 24 | + |
| 25 | +* Click **Create repository**: |
| 26 | + |
| 27 | +  |
| 28 | + |
| 29 | +* Give a name and then create the repository: |
| 30 | + |
| 31 | +  |
| 32 | + |
| 33 | +* Copy URI of your repository for the next part: |
| 34 | + |
| 35 | +  |
| 36 | + |
| 37 | +## Part 3: Push Docker image to ECR |
| 38 | + |
| 39 | +* Retrieve an authentication token and authenticate your Docker client to your registry: |
| 40 | + |
| 41 | +`aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 664418964547.dkr.ecr.us-east-1.amazonaws.com/sagemaker/r-kernel` |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | +* Tag your image so you can push the image to this repository: |
| 46 | + |
| 47 | +`docker tag public.ecr.aws/v8e3m3v4/sagemaker-studio/r:latest 664418964547.dkr.ecr.us-east-1.amazonaws.com/sagemaker/r-kernel:latest` |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | +* Run the following command to push this image to your newly created AWS repository: |
| 52 | + |
| 53 | +`docker push 664418964547.dkr.ecr.us-east-1.amazonaws.com/sagemaker/r-kernel:latest` |
| 54 | + |
| 55 | + |
0 commit comments