How to Push, Pull, and Run a Docker Image Using AWS ECR | Elastic Container Registry Tutorial (2025)



Want to store and manage **Docker images** using **AWS Elastic Container Registry (ECR)**? πŸš€ In this tutorial, I’ll guide you through **pushing, pulling, and running Docker images** with AWS ECR, step by step. By the end of this video, you’ll know how to: βœ… **Create an AWS ECR repository** βœ… **Push Docker images** to AWS ECR βœ… **Pull images** from AWS ECR βœ… **Run Docker containers** from an AWS ECR image — ## **πŸ”Ή What You’ll Learn in This Video:** βœ”οΈ How to **set up AWS ECR** βœ”οΈ How to **authenticate Docker with AWS ECR** βœ”οΈ How to **push and pull Docker images** βœ”οΈ How to run a **container from an AWS ECR image** — ## **πŸ”Ή Prerequisites** βœ”οΈ **AWS CLI Installed** ([Download AWS CLI](https://aws.amazon.com/cli/)) βœ”οΈ **Docker Installed** ([Download Docker](https://www.docker.com/get-started)) βœ”οΈ An **AWS Account** ([Sign Up](https://aws.amazon.com/)) βœ”οΈ Basic knowledge of **Docker commands** — ## **πŸ”Ή Step 1: Create an AWS ECR Repository** 1️⃣ **Login to AWS Console** → Go to **ECR (Elastic Container Registry)** 2️⃣ Click **Create Repository** 3️⃣ Choose **Public or Private** repository 4️⃣ Copy the **repository URI** for later Alternatively, create a repository using the AWS CLI: “`bash
aws ecr create-repository –repository-name my-docker-app
“` — ## **πŸ”Ή Step 2: Authenticate Docker with AWS ECR** Use the AWS CLI to log in to ECR: “`bash
aws ecr get-login-password –region us-east-1 | docker login –username AWS –password-stdin [aws_account_id].dkr.ecr.us-east-1.amazonaws.com
“` πŸ”Ή Replace **us-east-1** with your AWS region. πŸ”Ή Replace **[aws_account_id]** with your actual AWS account ID. — ## **πŸ”Ή Step 3: Build and Tag a Docker Image** If you have a **Dockerfile**, build the image: “`bash
docker build -t my-docker-app .
“` Tag the image with your ECR repository URL: “`bash
docker tag my-docker-app:latest [aws_account_id].dkr.ecr.us-east-1.amazonaws.com/my-docker-app:latest
“` — ## **πŸ”Ή Step 4: Push the Docker Image to AWS ECR** Now, push the image to your AWS ECR repository: “`bash
docker push [aws_account_id].dkr.ecr.us-east-1.amazonaws.com/my-docker-app:latest
“` Once uploaded, your image will be available in AWS ECR. — ## **πŸ”Ή Step 5: Pull the Docker Image from AWS ECR** On another system or EC2 instance, **pull the image**: “`bash
docker pull [aws_account_id].dkr.ecr.us-east-1.amazonaws.com/my-docker-app:latest
“` To verify the pulled image, run: “`bash
docker images
“` — ## **πŸ”Ή Step 6: Run a Docker Container from AWS ECR Image** Run the container locally: “`bash
docker run -d -p 5000:5000 [aws_account_id].dkr.ecr.us-east-1.amazonaws.com/my-docker-app:latest
“` πŸ”Ή This command runs the container and maps port **5000** to your local machine. — ## **πŸ”Ή Common Issues & Fixes** πŸ”Ή **Denied: requested access to the resource is denied** βœ… **Fix:** Ensure your AWS CLI is configured with `aws configure`. πŸ”Ή **Error: authentication required** βœ… **Fix:** Re-run the `docker login` command to authenticate. πŸ”Ή **Image not found when pulling** βœ… **Fix:** Double-check the **repository name** and **region**. — ## **πŸ”Ή Who Is This Tutorial For?** βœ… Developers working with **AWS & Docker** βœ… DevOps engineers managing **container registries** βœ… Anyone deploying **containerized applications** — ## **πŸ”Ή More AWS & Docker Tutorials:** πŸ“Œ **How to Deploy a Dockerized Flask App on AWS ECS** → [Watch Now] πŸ“Œ **How to Use AWS Lambda with Docker Containers** → [Watch Now] πŸ“Œ **How to Set Up Continuous Deployment with AWS ECR & GitHub Actions** → [Watch Now] — ## **πŸ‘ Like, Share & Subscribe!** If this tutorial helped you, please **LIKE, SHARE, and SUBSCRIBE** for more **AWS, Docker, and DevOps tutorials**! πŸš€ πŸ’¬ Have questions? Drop them in the **comments** below! — ### **πŸ”Ή Hashtags:** #AWS #Docker #AWSCloud #ECR #ElasticContainerRegistry #DevOps #CloudComputing #Containerization #Microservices #DockerHub Now you know how to **push, pull, and run Docker images using AWS ECR** like a pro! πŸš€πŸ³