This project demonstrates how to create and use a local Docker Registry on an AWS Ubuntu EC2 instance.
The workflow includes:
- Running a local Docker Registry container
- Pulling Docker images from Docker Hub
- Tagging images for local registry usage
- Pushing images into the local registry
- Removing local images
- Pulling images back from the local registry
Docker Hub
↓
Pull alpine image
↓
Local Docker Host
↓
Tag image
↓
Local Docker Registry (localhost:5000)
↓
Push image
↓
Delete local image
↓
Pull image again from local registry
docker-local-registry/
│
├── screenshots/
│ ├── registry-running.png
| ├── local-registry-script.png
| ├── full-script-output.png
│
├── local-registry.sh
│
├── README.md
|
├── .gitignore
Before running this project, make sure the following are installed:
- Docker
- Git
- Ubuntu EC2 Instance (or any Linux machine)
Run the following command to start a local Docker Registry container:
docker run -dt \
--name local-registry \
-p 5000:5000 \
registry:2This creates a Docker Registry running on port 5000.
docker pull alpine:latestThis downloads the Alpine Linux image from Docker Hub.
docker tag alpine:latest localhost:5000/my-secure-alpine:latestThis retags the image so it can be pushed into the local registry.
docker push localhost:5000/my-secure-alpine:latestThis uploads the image into the local Docker Registry.
docker rmi localhost:5000/my-secure-alpine:latest
docker rmi alpine:latestThis removes local copies of the image to verify that the registry stores the image successfully.
docker imagesThis checks whether the image was removed locally.
docker pull localhost:5000/my-secure-alpine:latestThis pulls the image back from the local Docker Registry.
docker psYou should see the registry:2 container running.
The project includes the following automation script:
local-registry.shThis script automates:
- Registry creation
- Image pull
- Image tagging
- Image push
- Image deletion
- Image re-pull
- This project uses a local development registry.
- The registry currently runs without HTTPS or authentication.
- This setup is intended for learning and testing purposes only.
git clone https://github.com/manojselvang/docker-local-registrychmod +x local-registry.sh
./local-registry.shManoj Selvan

