mkdir -p certs && \
openssl req -newkey rsa:4096 -nodes -sha256 \
-keyout certs/domain.key \
-x509 -days 365 \
-out certs/domain.crt
You will be prompted for several values.
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:Texas
Locality Name (eg, city) []:Austin
Organization Name (eg, company) [Internet Widgits Pty Ltd]:My Company
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:registry.example.com
If you are using the self-signed certificate for a docker registry,
each docker daemon at the client side will need the domain.crt
file
copied to docker configuration directory.
sudo mkdir -p /etc/docker/certs.d/registry.example.com
sudo cp certs/domain.crt /etc/docker/certs.d/registry.example.com/ca.crt
You will then need to restart the docker engine on the client side:
sudo service docker restart