Own docker repository: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
 
(18 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
=first steps=
+
=Create Directorys=
*[[ubuntu paket von docker installieren| install from ubuntu-package from docker  ]]
+
*mkdir /var/docker/{certs,auth}
=nginx install=
+
=Create httpasswd=
* # apt-get install nginx git apache2-utils
+
*htpasswd -bc /var/docker/auth/htpasswd xinux geheim
* # git clone https://github.com/docker/docker-registry
+
=Copy certs=
* # cp docker-registry/contrib/nginx/nginx_1-3-9.conf /etc/nginx/conf.d/
+
*cp /etc/letsencrypt/live/docker.yourdomain.de/{cert.pem,privkey.pem} /var/lib/docker/certs
* # cp docker-registry/contrib/nginx/docker-registry.conf /etc/nginx/
 
  
=nginx add user=
+
=Certification=
* # touch /etc/nginx/docker-registry.htpasswd
+
*[[Letsencrypt]]
* # htpasswd -b /etc/nginx/docker-registry.htpasswd USERNAME-X PASSWORD-X
+
*certbot-auto certonly -d docker.yourdomain.de
* # htpasswd -b /etc/nginx/docker-registry.htpasswd USERNAME-Y PASSWORD-Y
 
  
=get certifikates=
 
; there are many howtos ...
 
* # 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 !!!=
 
  
=login=
 
* # docker login https://yourhost.yourdomain.com
 
  
=image tagen=
+
=Create Docker=
* # docker tag own-image yourhost.yourdomain.com/own-image
+
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 /var/lib/docker/certs/:/certs \
 +
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/cert.pem  \
 +
-e REGISTRY_HTTP_TLS_KEY=/certs/privkey.pem registry:2
  
=image pushen(one host)=
+
=search=
* # docker push yourhost.yourdomain.com/own-image
+
*curl -u xinux https://your.registry:5000/v2/_catalog
  
=image pull(other host)=
 
* # docker pull yourhost.yourdomain.com/own-image
 
  
=links=
+
 
*http://java.dzone.com/articles/create-your-own-private-docker
+
https://docker.yourdomain.de/v2/_catalog
*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
+
=Links=
*https://medium.com/@deeeet/building-private-docker-registry-with-basic-authentication-with-self-signed-certificate-using-it-e6329085e612
+
*https://docs.docker.com/registry/deploying/#alternatives
 +
*https://docs.docker.com/registry/
 +
*http://blog.agilepartner.net/private-docker-registry-configuration/

Aktuelle Version vom 10. Mai 2017, 18:37 Uhr

Create Directorys

  • mkdir /var/docker/{certs,auth}

Create httpasswd

  • htpasswd -bc /var/docker/auth/htpasswd xinux geheim

Copy certs

  • cp /etc/letsencrypt/live/docker.yourdomain.de/{cert.pem,privkey.pem} /var/lib/docker/certs

Certification

  • Letsencrypt
  • certbot-auto certonly -d docker.yourdomain.de



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 /var/lib/docker/certs/:/certs \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/cert.pem  \
-e REGISTRY_HTTP_TLS_KEY=/certs/privkey.pem registry:2

search


https://docker.yourdomain.de/v2/_catalog

Links