November 9, 2017

How to Use Notary

Notary is a tool for publishing and managing trusted collections of content. Publishers can digitally sign collections and consumers can verify integrity and origin of content. This ability is built on a straightforward key management and signing interface to create signed collections and configure trusted publishers

With Notary anyone can provide trust over arbitrary collections of data. Using The Update Framework (TUF) as the underlying security framework, Notary takes care of the operations necessary to create, manage, and distribute the metadata necessary to ensure the integrity and freshness of your content. To fully understand the content of this blogpost please read carefully these docs: Getting Started with Notary and Use Notary

Note: Notary Server, Notary Signer and Notary DB should be installed first!


You should enable docker content trust, It can be done via setting environment variables:

export DOCKER_CONTENT_TRUST_SERVER=https://<ip-address-of-your-server>

Note that you will not be able to pull images from docker hub until DOCKER_CONTENT_TRUST equals 1


[root@harbor:~] docker pull busybox
Using default tag: latest
Error: error contacting notary server: received unexpected HTTP status: 500 Internal Server Error

[root@harbor:~] export DOCKER_CONTENT_TRUST=0

[root@harbor:~] docker pull busybox
Using default tag: latest
latest: Pulling from library/busybox
03b1be98f3f9: Pull complete
Digest: sha256:3e8fa85ddfef1af9ca85a5cfb714148956984e02f00bec3f7f49d3925a91e0e7
Status: Downloaded newer image for busybox:latest


OK, let’s try to test Notary now. First let’s try to pull an unsigned image:

root@harbor:~] docker pull
No trust data for 42.2

So with DOCKER_CONTENT_TRUST equals 1 we cannot pull the unsigned images anymore. Now let’s try to sign the image and push it into our repository

[root@harbor:~] docker push
The push refers to a repository []
3900d76accd7: Layer already exists
latest: digest: sha256:21cb851fa47050bacac343b3c87d7042f54a804f5b47fcba0be6873ca3d80ed7 size: 529
Signing and pushing trust metadata
Enter passphrase for root key with ID ce3ef53:
Enter passphrase for new repository key with ID 2719e45 (
Repeat passphrase for new repository key with ID 2719e45 (
Finished initializing ""
Successfully signed "":42.2

The image was successfully signed and pushed. Now anyone from your team can use this image.

[root@harbor:~] docker pull
Pull (1 of 1):
sha256:b4c4061fd2c55a90735232852efb1a694b396dd41f4152f761eaa1aece07eb22: Pulling from library/opensuse
0b4bc6c2ad2d: Pull complete
Digest: sha256:b4c4061fd2c55a90735232852efb1a694b396dd41f4152f761eaa1aece07eb22
Status: Downloaded newer image for
Tagging as

Creative Commons - Attribution, Noncommercial, No Derivative Works 3.0 License