Giter VIP home page Giter VIP logo

private-docker-registry-example's Introduction

DAS Private Docker Registry

A guide to launch a private docker registry secured with Lets Encrypt. Tested on Ubuntu 16.04 and Apache 2.4

Create htpasswd file

For each user you'd like to authenticate, run the following command: docker run --entrypoint htpasswd registry:2 -Bbn {user_name} {user_password} > /choose/path/to/htpasswd * Replace {user_name} and {user_password} for each user you'd like to add.

Configure Apache

  1. Edit the registry.domain.com.conf file
    • Replace domain with the name of the domain the registry will be hosted on in the file name and 6 places within the file
    • Leave the unsecure ssl paths alone until after you've generated the certificates.
    • Replace /path/to/file/ with the path to the htpasswd file.
  2. Copy the file to the apache sites-available folder, typically /etc/apache2/sites-available.
  3. Activate the site, sudo a2ensite registry.{domain}.com.conf.
  4. Restart the server, sudo service apache2 restart.
  5. Test that the page is served at https://registry.{domain}.com, you should see a default apache page after accepting the insecure ssl cert.

SSL Certificate

If using Lets Encrypt

  1. sudo git clone https://github.com/certbot/certbot /opt/certbot
  2. cd /opt/certbot/; ./certbot-auto certonly --apache -d registry.{domain}.com
  3. Your files should be stored in /etc/letsencrypt/live/{domain}
  4. Navigate to the ssl certificate folder and run the following commands:
    • sudo cp privkey.pem /path/to/docker/registry/folder/domain.key
    • sudo cat cert.pem chain.pem > /path/to/docker/registry/folder/domain.crt
  5. Update your registry.{domain}.com.conf file to link to the new ssl certificates.
    • SSLCertificateFile /etc/letsencrypt/live/registry.{domain}.com/fullchain.pem
    • SSLCertificateKeyFile /etc/letsencrypt/live/registry.{domain}.com/privkey.pem
    • Uncomment the Include /etc/letsencrypt/options-ssl-apache.conf
  6. Run sudo service apache2 restart.
  7. Verify that the url now shows a secured page.

Anything else

Adapt the above instructions

Configure Docker

  1. Copy the docker-compose.yml file to the server.
  2. Run docker-compose up -d. If you run into problems, remove the -d flag and look for errors.

Test

  1. From your local machine, run docker login registry.{domain}.com. Enter your username and password.
  2. If you run into errors, look at the return here, the output from the docker container running on the server and anything in the apache error logs.

private-docker-registry-example's People

Contributors

ethanf22 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.