Skip to content

Instantly share code, notes, and snippets.

@bitdivine
Created July 18, 2017 10:44
Show Gist options
  • Save bitdivine/82811dafa8d75276bc7001d2278a21c6 to your computer and use it in GitHub Desktop.
Save bitdivine/82811dafa8d75276bc7001d2278a21c6 to your computer and use it in GitHub Desktop.
Secure Docker Registry

Create a secure docker registry

Note: You will almost certainly want to add some storage options: Note: This is correct as of July 2017. The official Docker docs give the wrong port number but are otherwise correct. https://docs.docker.com/registry/deploying/

  • Create a cert with whatever tools you normally use:

    (.ve) maxim@space:~/pumpernikel-pristine/tools/ansible$ ./bin/ssl-client-gencert docker.pumpernikel.com

  • Run:

    docker run -d
    --restart=always
    --name registry
    -v pwd/certs:/certs
    -e REGISTRY_HTTP_ADDR=0.0.0.0:443
    -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt
    -e REGISTRY_HTTP_TLS_KEY=/certs/domain.key
    -p 443:443
    registry:2

    docker stop registry && docker rm -v registry

    curl 'https://docker.pumpernikel.com/v2/_catalog'

    docker pull ubuntu:16.04 docker tag ubuntu:16.04 docker.pumpernikel.com/pumpernikel/ubuntu docker push docker.pumpernikel.com/pumpernikel/ubuntu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment