This repository contains a demo project created as part of my DevOps studies in the TechWorld with Nana – DevOps Bootcamp.
https://www.techworld-with-nana.com/devops-bootcamp
Demo Project: Create repository on AWS and push to private Docker registry Technologies used: Docker, Amazon ECR
Project Description:
- Create private Docker registry on AWS (Amazon ECR)
- Tag and Push Docker image to this private repository
- In the AWS Console, navigate to Elastic Container Registry (ECR)
- Click Create repository
- Set the repository name to
appand click Create - Open the repository and click View push commands to see your registry URI and authentication steps
Note: The registry URI follows the format
<account-id>.dkr.ecr.<region>.amazonaws.com
Avoid using root credentials. Instead, create a scoped IAM user.
In the AWS Console, go to IAM → Users → Create user:
| Field | Value |
|---|---|
| User name | ecr-user |
| Permission strategy | Add to group |
Create a new IAM group:
| Field | Value |
|---|---|
| Group name | ecr-group |
| Permissions policy | AmazonEC2ContainerRegistryFullAccess |
Generate an access key for CLI access:
- Go to the user → Security credentials → Create access key
- Select use case: Command Line Interface (CLI)
- Download the
.csvfile — store it securely, you won't be able to retrieve the secret again
Configure the AWS CLI with a named profile:
aws configure --profile ecrEnter the credentials from the downloaded .csv:
AWS Access Key ID [None]: <from csv>
AWS Secret Access Key [None]: <from csv>
Default region name [None]: <region> # e.g. us-east-1
Default output format [None]: # leave blank or use json
Authenticate Docker to ECR:
aws ecr get-login-password \
--region <region> \
--profile ecr \
| docker login \
--username AWS \
--password-stdin <account-id>.dkr.ecr.<region>.amazonaws.comNote: The ECR login token expires after 12 hours — re-run this command if you get an authentication error.
Build the image (targeting linux/amd64 for EC2 compatibility, even on Apple Silicon):
docker build --platform linux/amd64 -t app:1.0 .Tag the image with the full ECR registry URI:
docker tag app:1.0 <account-id>.dkr.ecr.<region>.amazonaws.com/app:1.0Push the image to ECR:
docker push <account-id>.dkr.ecr.<region>.amazonaws.com/app:1.0Or use the provided helper script to do all three steps at once:
AWS_ACCOUNT_ID=123456789012 AWS_REGION=us-east-1 ./push.sh



