Load the private key with a specific name
In this step, you will learn how to load a private key into the Docker trust keystore with a specific name. While you can simply copy the key file as you did in the previous step, using the docker trust key load
command allows you to associate a specific name with the key within the Docker trust system. This can be helpful for managing multiple signing keys.
First, ensure you are in the ~/project
directory where you created the private key file my-signing-key.pem
.
cd ~/project
Now, use the docker trust key load
command to load the private key. You will be prompted to enter a name for the key. Let's name this key my-signer
.
docker trust key load my-signing-key.pem --name my-signer
When prompted, enter my-signer
as the name for the key.
Loading key from 'my-signing-key.pem'...
Enter name for new key: my-signer
After entering the name, you will be prompted to enter a passphrase for the new key. For this lab, you can leave the passphrase empty by just pressing Enter. In a real-world scenario, it is highly recommended to use a strong passphrase to protect your private key.
Enter passphrase for new key:
Repeat passphrase for new key:
You should see output indicating that the key has been successfully loaded.
Successfully loaded private key from 'my-signing-key.pem' with ID '...'
To verify that the key has been loaded with the specified name, you can list the keys in your Docker trust keystore using the docker trust key list
command.
docker trust key list
You should see an entry with the NAME my-signer
and a corresponding KEY ID. This confirms that you have successfully loaded the private key with a specific name.