docker run -d -p 5000:5000 --restart=always --name my-registry registry:2
#To check the list of images pushed , use
curl -X GET localhost:5000/v2/_catalog
#to push some images to our registry server.
#Let's push two images for now .i.e. nginx:latest and httpd:latest.
Run:
docker pull nginx:latest
then
docker image tag nginx:latest
localhost:5000/nginx:latest
and finally push it using
docker push localhost:5000/nginx:latest.
#We will use the same steps for the second
image docker pull httpd:latest
and then
docker image tag httpd:latest
localhost:5000/httpd:latest
and finally push it using
docker push localhost:5000/httpd:latest
docker image prune -a
#WARNING!
This will remove all images without at least one container associated to them.
docker image ls
#to view number of images
#to pull images from local server
docker pull [server-addr/image-name]
docker pull localhost:5000/nginx
#to stop and remove registry
Use: docker stop my-registry and then docker rm my-registry