docker trust key generate

Estimated reading time: 2 minutes


Generate and load a signing key-pair

Usage

$ docker trust key generate NAME

Refer to the options section for an overview of available OPTIONS for this command.

Description

docker trust key generate generates a key-pair to be used with signing, and loads the private key into the local docker trust keystore.

For example uses of this command, refer to the examples section below.

Options

Name, shorthand Default Description
--dir Directory to generate key in, defaults to current directory

Examples

Generate a key-pair

$ docker trust key generate alice

Generating key for alice...
Enter passphrase for new alice key with ID 17acf3c:
Repeat passphrase for new alice key with ID 17acf3c:
Successfully generated and loaded private key. Corresponding public key available: alice.pub
$ ls
alice.pub

The private signing key is encrypted by the passphrase and loaded into the docker trust keystore. All passphrase requests to sign with the key will be referred to by the provided NAME.

The public key component alice.pub will be available in the current working directory, and can be used directly by docker trust signer add.

Provide the --dir argument to specify a directory to generate the key in:

$ docker trust key generate alice --dir /foo

Generating key for alice...
Enter passphrase for new alice key with ID 17acf3c:
Repeat passphrase for new alice key with ID 17acf3c:
Successfully generated and loaded private key. Corresponding public key available: alice.pub
$ ls /foo
alice.pub

Parent command

Command Description
docker trust key Manage keys for signing Docker images
Command Description
docker trust key generate Generate and load a signing key-pair
docker trust key load Load a private key file for signing