Create your own docker private registry without GUI simplest way

docker run -d -p 5000:5000 --restart=always --name registry registry:2
$ docker pull nginx
$ docker image tag nginx localhost:5000/nginx-test
$ docker push nginx:5000/nginx-test
$ docker push localhost:5000/nginx-test 
Error response from daemon: Get https://localhost:5000/v2/: http: server gave HTTP response to HTTPS client
{
"insecure-registries" : ["localhost:5000"]
}
$ docker push localhost:5000/nginx-test
Use curl command in CLI:
To get a list of repositories pushed on the private registry:
curl <host_ip>:<docker_host_port>/v2/<repository_name>/tags/list
To get a list of images pushed on the private registry
curl <docker_host_ip>:<docker_host_port>/v2/_catalog
$ docker run -d --restart=always --name registry -v "$(pwd)"/certs:/certs -e REGISTRY_HTTP_ADDR=0.0.0.0:443 -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/ca.crt -e REGISTRY_HTTP_TLS_KEY=/certs/domain.key   -p 443:443 -p 80:80 registry:2
$ docker pull nginx
$ docker tag node myregistry.domain.com/nginx
$ docker push myregistry.domain.com/nginx
$ docker pull myregistry.domain.com/nginx
https://<host_ip>:<docker_host_port>/v2/<repository_name>/tags/list
https://<docker_host_ip>:<docker_host_port>/v2/_catalog
docker run --entrypoint htpasswd httpd:2 -Bbn testuser testpassword > auth/htpasswd
$ docker run -d --restart=always --name registry -v "$(pwd)"/certs:/certs -v "$(pwd)"/auth:/auth  -e "REGISTRY_AUTH=htpasswd" -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd -e REGISTRY_HTTP_ADDR=0.0.0.0:443 -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/ca.crt -e REGISTRY_HTTP_TLS_KEY=/certs/domain.key   -p 443:443 -p 80:80 registry:2
$ docker pull nginx
$ docker tag node myregistry.domain.com/nginx:v2
$ docker login myregistry.domain.com (Inject login username and password as mentioned in above command)
$ docker push myregistry.domain.com/nginx:v2
$ docker pull myregistry.domain.com/nginx:v2
https://<host_ip>:<docker_host_port>/v2/<repository_name>/tags/list
https://<docker_host_ip>:<docker_host_port>/v2/_catalog

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store