Skip to content

Instantly share code, notes, and snippets.

@anokun7
Created August 26, 2015 21:57
Show Gist options
  • Save anokun7/805f2c74189757dea00e to your computer and use it in GitHub Desktop.
Save anokun7/805f2c74189757dea00e to your computer and use it in GitHub Desktop.
Docker Trusted Registry - Initial login
DTR uses SSL certificates in addition to a login/password to login.
The steps to use openssl to create a self-signed certificate as below:
1. First create a private key (myserver.key) and a certificate signing request (server.csr)
openssl req -nodes -newkey rsa:2048 -keyout myserver.key -out server.csr
2. Finally create the SSL certificate (server.crt) using the csr and private key just created:
openssl x509 -req -days 365 -in server.csr -signkey myserver.key -out server.crt
3. In the DTR web interface, go to Settings -> Security and paste the contents of the SSL certificate
and the private key in the appropriate text areas.
Now when running the docker login command, you should be able to login using the credentials provided:
$>> docker login engine.docker.demo
Username: anoop
Password:
Email: [email protected]
WARNING: login credentials saved in /home/vagrant/.dockercfg.
Login Succeeded
@anokun7
Copy link
Author

anokun7 commented Sep 3, 2015

On CentOS [These have been tested to work].

Ensure DNS is setup or /etc/hosts file updated on all hosts. All hosts should be able to resolve the DTR host`

export DOMAIN_NAME=<DNS of DTR>
sudo update-ca-trust enable
openssl s_client -connect $DOMAIN_NAME:443 -showcerts </dev/null 2>/dev/null | openssl x509 -outform PEM | sudo tee /etc/pki/ca-trust/source/anchors/$DOMAIN_NAME.crt
sudo update-ca-trust extract

sudo systemctl restart docker.service
docker login --username=anoop --password=password [email protected] $DOMAIN_NAME

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