Getting YubiKey working with Docker Content Trust on OS X

Getting YubiKey working with Docker Content Trust on OS X

This wasn’t as straightforward as I would’ve liked, so I’m documenting this here.

First, some super-useful sources:

I only figured this out because the folks above did most of the work!

Preparation…

Install notary

Just a matter of grabbing the latest from https://github.com/docker/notary/releases and putting the notary binary in the path somewhere (like ~/bin in my case).

Install the YubiKey PIV shared libraries

Configuration…

Ok now we’re ready to create a key:

Signing on push

And now for the magic:

$ export DOCKER_CONTENT_TRUST=1
$ docker build -t hairyhenderson/dct-test:latest
...
$ docker push hairyhenderson/dct-test:latest
The push refers to a repository [docker.io/hairyhenderson/dct-test]
e520aba5adf5: Layer already exists
917d421641b4: Layer already exists
e9d17ff7ca16: Layer already exists
63bcbfab7dc5: Layer already exists
af21bd4b5bb1: Layer already exists
4b0b3b9ff599: Layer already exists
d1e800db26c7: Layer already exists
42755cf4ee95: Layer already exists
latest: digest: sha256:deadbeef25599d9a37bd452ba6918ac198693fe4b9f9822d0a4bf54735469f04 size: 1974
Signing and pushing trust metadata
Please touch the attached Yubikey to perform signing.
Enter passphrase for new repository key with ID 7ff917d (docker.io/hairyhenderson/dct-test):
Repeat passphrase for new repository key with ID 7ff917d (docker.io/hairyhenderson/dct-test):
Please touch the attached Yubikey to perform signing.
Finished initializing "docker.io/hairyhenderson/dct-test"
Successfully signed "docker.io/hairyhenderson/dct-test":latest

This is as far as I’ve gotten… Maybe more to come later!

comments powered by Disqus