Own docker repository: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
Zeile 1: Zeile 1:
=first steps=
 
*[[ubuntu paket von docker installieren| install from ubuntu-package from docker  ]]
 
=nginx install=
 
* # apt-get install nginx git apache2-utils
 
* # git clone https://github.com/docker/docker-registry
 
* # cp docker-registry/contrib/nginx/docker-registry.conf /etc/nginx/
 
* # cp docker-registry/contrib/nginx/nginx_1-3-9.conf /etc/nginx/conf.d/
 
==search fix==
 
;add /v1/search-block to the file /etc/nginx/nginx_1-3-9.conf after the block:
 
location /v1/_ping {
 
...
 
  }
 
  
location /v1/search {
+
=Create Docker=
    auth_basic off;
 
    include              docker-registry.conf;
 
  }
 
  
=nginx add user=
+
docker run -d -p 5000:5000 --restart=always --name registry -v /var/lib/docker/auth:/auth  -e "REGISTRY_AUTH=htpasswd"   -e "REGISTRY_AUTH_HTPASSWD_REALM=XINX DOCKER Registry"  -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd -v /etc/letsencrypt/live/docker.yourdomain.de/:/certs  -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/cert.pem  -e REGISTRY_HTTP_TLS_KEY=/certs/privkey.pem registry:2
* # touch /etc/nginx/docker-registry.htpasswd
 
* # htpasswd -b /etc/nginx/docker-registry.htpasswd USERNAME-X PASSWORD-X
 
* # htpasswd -b /etc/nginx/docker-registry.htpasswd USERNAME-Y PASSWORD-Y
 
 
 
=get certifikates=
 
; there are many howtos for openssl
 
* # cat ca.pem >> /etc/ssl/certs/ca-certificates.crt
 
* # cp server-cert.pem /etc/ssl/certs/docker-registry
 
* # cp server-key.pem /etc/ssl/private/docker-registry
 
* # sed -ie "s/my.docker.registry.com/yourhost.yourdomain.com/" /etc/nginx/conf.d/nginx_1-3-9.conf
 
* # service nginx restart
 
 
 
=start docker registry=
 
* # docker run -d --name my-registry -e GUNICORN_OPTS=[--preload] -e STORAGE_PATH=/registry -p 127.0.0.1:5000:5000 -v  /registry:/registry registry
 
  GUNICORN_OPTS=[--preload] only important at the first start
 
=!!! FINISH !!!=
 
=CLIENT=
 
!!!IMPORTANT!!!
 
*cat ca.pem >> /etc/ssl/certs/ca-certificates.crt
 
 
 
=login=
 
* # docker login https://yourhost.yourdomain.com
 
 
 
=image tagen=
 
* # docker tag own-image yourhost.yourdomain.com/own-image
 
 
 
=image pushen(one host)=
 
* # docker push yourhost.yourdomain.com/own-image
 
 
 
=image pull(other host)=
 
* # docker pull yourhost.yourdomain.com/own-image
 
 
 
=links=
 
*http://java.dzone.com/articles/create-your-own-private-docker
 
*http://blog.docker.com/2013/07/how-to-use-your-own-registry/
 
*http://stackoverflow.com/questions/24990784/docker-what-is-the-simplest-way-to-secure-a-private-registry
 
*https://medium.com/@deeeet/building-private-docker-registry-with-basic-authentication-with-self-signed-certificate-using-it-e6329085e612
 

Version vom 10. Mai 2017, 10:57 Uhr

Create Docker

docker run -d -p 5000:5000 --restart=always --name registry -v /var/lib/docker/auth:/auth -e "REGISTRY_AUTH=htpasswd" -e "REGISTRY_AUTH_HTPASSWD_REALM=XINX DOCKER Registry" -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd -v /etc/letsencrypt/live/docker.yourdomain.de/:/certs -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/cert.pem -e REGISTRY_HTTP_TLS_KEY=/certs/privkey.pem registry:2