• Home
  • Docker
  • Kubernetes
  • Java
  • Ubuntu
  • Maven
  • Big Data
  • CI
  • Install
  • Samples
  • Archived
Docker | Set up a private Docker registry (Ubuntu)
  1. Notes
  2. Configure /etc/ssl/openssl.cnf
  3. Generate a self-signed certificate
  4. Create htpasswd
  5. Configure config.yml
  6. Create the registry Dockerfile
  7. Build the registry Docker image
  8. Run the registry
  9. Test the registry
  10. Push an image into the registry
  11. Pull an image from the registry
  12. Verify the created repositories inside the Registry's container
  13. Verify the created repositories using the Registry API

  1. Notes
    Please see these pages for more information:
    https://docs.docker.com/registry/
    https://docs.docker.com/registry/spec/api/
    https://docs.docker.com/registry/configuration/
  2. Configure /etc/ssl/openssl.cnf
    First you need to configure openssl.cnf to avoid getting this error when you try to log into the registry using the ip address:

    To fix this error: add your IP address under the section v3_ca
  3. Generate a self-signed certificate
    Create a working directory:

    Generate certificate:


    Copy certificate into /etc/docker/certs.d/ directory:

    Restart Docker:
  4. Create htpasswd

    Create htpasswd with username/password: admin/admin:

  5. Configure config.yml
    Please see this page for more information: https://docs.docker.com/registry/configuration/

    Create config.yml file (please make sure to adjust the http host with your IP address):
  6. Create the registry Dockerfile
  7. Build the registry Docker image
    First let's check that you have all the required files:

    Build registry:
  8. Run the registry

  9. Test the registry
    • Login to registry:

      Verify ~/.docker/config.json:

      Decode "auth" value:

    • Logout from registry:

      Verify ~/.docker/config.json:
  10. Push an image into the registry
    Let's first tag an existing image:

    List images:

    Push the image to registry:

    If you get the following error, then you are probably not logged in to the registry (see above):
  11. Pull an image from the registry

    If you get the following error, then you are probably not logged in to the registry (see above):
  12. Verify the created repositories inside the Registry's container

    List repositories:

    Verify the registry configuration:
  13. Verify the created repositories using the Registry API
    Check API Version:

    List repositories:

    Note the option -k with the curl command. It's used to suppress this certificate error:
© 2025  mtitek