Skip to content

Instantly share code, notes, and snippets.

@rgodishela
Created April 23, 2017 16:03
Show Gist options
  • Save rgodishela/a262c392c4114ccb3b95d04b82ce5399 to your computer and use it in GitHub Desktop.
Save rgodishela/a262c392c4114ccb3b95d04b82ce5399 to your computer and use it in GitHub Desktop.
Docker-registry enables you to store your docker images and helps you to access them locally and within your organisation.
1. Install docker-registry
yum install docker-registry
2. Install firewalld
yum install firewalld
3. enable the Docker service to come alive after reboot
systemctl enable docker
4. Start the docker daemon
systemctl start docker
5. Enable firewalld service to come alive after reboot
systemctl enable firewalld
6. Start firewalld service
systemctl start firewalld
7. Open 5000 Port
firewall-cmd –zone=public –add-port=5000/tcp –permanent
8. List out the ports which are opened by firewall-cmd
firewall-cmd –zone=public –list-ports
9. Enable docker-registry to come alive after reboot
systemctl enable docker-registry
10. start the docker-registry
systemctl start docker-registry
11. add this private registry details with docker
uncomment and update ADD_REGISTRY value as below
ADD_REGISTRY=’–add-registry localhost:5000′
uncomment and update INSECURE_REGISTRY value as below
INSECURE_REGISTRY=’–insecure-registry localhost:5000′
uncomment and update BLOCK_REGISTRY value as below
BLOCK_REGISTRY=’–block_registry docker.io’
12. Restart Docker service
systemctl restart docker
Test whether your private docker registry working or not?!
1. Pull an image from docker hub to test or if you have an image already in your machine then go for step
docker pull nginx
2. Create a new tag like below
docker tag nginx localhost:5000/my-private-nginx-from-local:v1
3. Push the image to your just created private docker-registry
docker push localhost:5000/my-private-nginx-from-local:v1
4. Remove the image which you have downloaded from Dockerhub
docker rmi nginx
5. Remove the image which you have just tagged to push
docker rmi localhost:5000/my-private-nginx-from-local:v1
6. Pull the image which you have pushed to your private registry, you may notice that it would pull from localhost:5000 which your private registry
docker pull localhost:5000/my-private-nginx-from-local:v1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment