Search code examples
dockerdocker-trusted-registry

How to register a new key for a docker registry


I created a docker image some time ago and used a key to sign it. But now I forgot the password for the key, so I tried creating a new key, which worked perfectly. But I can't remember how I got the key registered.

The following is from the official docker documentation under https://docs.docker.com/engine/security/trust/.

docker trust signer add --key cert.pem jeff registry.example.com/admin/demo

but when I create a key using

docker trust key generate somename

I only get a .key(private key) and a .pub(public key) file, but no .pem file. Is there any way I can convert a .pub file to a .pem file.


Solution

  • I believe this is a mistake in the documentation (or perhaps pem works as well), but I tested this right now and it works like:

    docker trust key generate nmishin
    

    And after that, you can add signer to the docker repository, like:

    docker trust signer add --key nmishin.pub nmishin registry.example.com/admin/demo
    

    Also I found a couple of articles that demonstrate the use of pub key also: hackernoon and trendmicro