When yor private numbers of docker images grow is time to setup you own private repo.
Do have you own docker repo you need 1. the docker registry 2. nginx to handel users 3. tls so that all conenctions are encrypted.
So here is what yu do to have you own docker repo running.
storage: image: busybox volumes: - /backup/docker/registry:/var/lib/docker/registry cache: image: redis registry: image: registry ports: - 127.0.0.1:5000:5000 links: - cache - storage volumes_from: - storage environment: STANDALONE: true SETTINGS_FLAVOR: local STORAGE_PATH: /var/lib/docker/registry SEARCH_BACKEND: sqlalchemy CACHE_REDIS_HOST: cache CACHE_REDIS_PORT: 6379 CACHE_LRU_REDIS_HOST: cache CACHE_LRU_REDIS_PORT: 6379 webb: #image: mattiashem/nginx-registry build: registry-front/ ports: - 443:443 - 80:80 links: - registry
create the folder registry-front in that folder we are going to add our users and our certs for the tls.
So create a Dockerfile and add the following
#Base docker file for lifeandshell.com FROM mattiashem/nginx-registry MAINTAINER "Mattias Hemmingsson" <matte.hemmingsson@gmail.com> EXPOSE 80 EXPOSE 443 ADD nginx.htpasswd /etc/nginx/nginx.htpasswd ADD cert.pem /etc/nginx/ssl/nginx.crt ADD privkey.pem /etc/nginx/ssl/nginx.key ADD fullchain.pem /etc/nginx/ssl/fullchain.pem CMD nginx -g "daemon off;"
The file I get from using letsencrypt that are free but you can get from any source. Chnage so that the source files are mathcing with you certs.
Now time for setting up some users create the file add_user.sh and add the followin content to it
docker run --rm --entrypoint htpasswd registry:2 -bn user1 password > nginx.htpasswd docker run --rm --entrypoint htpasswd registry:2 -bn user2 password >> nginx.htpasswd docker run --rm --entrypoint htpasswd registry:2 -bn user3 password >> nginx.htpasswd docker run --rm --entrypoint htpasswd registry:2 -bn user4 password >> nginx.htpasswd
make the script x and run intt In the registry-front folder
chmod +x add_user.sh ./add_user.sh
Now we are ready to start our registry do the the base filer with the docker-compose.yml and run
docker-compose build
docker-compose up
And now when everthing is wokring run
docker-compose start
And now you docker-registry should be up and running