Step 1: Pulling an Unsigned Image (without Content Trust)
On a UCP worker node, list existing images and pull the unsigned image yogeshraheja/tomcatone:v1 from Docker Hub:
Copy
Ask AI
[root@ucpworker ~]# docker image lsREPOSITORY TAG IMAGE ID CREATED SIZEdocker/ucp-pause 3.2.6 feb0e469f6ac 2 months ago 683kBdocker/ucp-agent 3.2.6 b9763a5e7df8 2 months ago 62.1MBdocker/ucp-hyperkube 3.2.6 56c3b92d2b4f 2 months ago 441MBdocker/ucp-calico-node 3.2.6 40091fdbb1b4 2 months ago 189MBdocker/ucp-calico-cni 3.2.6 dd89cabc02dd 2 months ago 162MB[root@ucpworker ~]# docker image pull yogeshraheja/tomcatone:v1v1: Pulling from yogeshraheja/tomcatone[...]Status: Downloaded newer image for docker.io/yogeshraheja/tomcatone:v1[root@ucpworker ~]# docker image lsREPOSITORY TAG IMAGE ID CREATED SIZEyogeshraheja/tomcatone v1 bd808d1... 5 days ago 497MB
By default, Docker allows pulling unsigned images from public registries.
Step 2: Enabling Docker Content Trust on a Single Host
To require signed images, set the DOCKER_CONTENT_TRUST environment variable:
Copy
Ask AI
[root@ucpworker ~]# export DOCKER_CONTENT_TRUST=1
Remove the previously pulled image and attempt to pull it again:
Copy
Ask AI
[root@ucpworker ~]# docker image rm yogeshraheja/tomcatone:v1[root@ucpworker ~]# docker image pull yogeshraheja/tomcatone:v1Error: remote trust data does not exist for docker.io/yogeshraheja/tomcatone: notary.docker.io does not have trust data
Docker refuses to pull the unsigned image when Content Trust is enabled.
Step 3: Enforcing Content Trust Cluster-Wide via UCP
Manually exporting an environment variable on each node is tedious. Instead, enforce Content Trust across your Docker Universal Control Plane (UCP) cluster:
Log in to UCP as an administrator.
Navigate to Admin Settings → Account Settings.
Enable Docker Content Trust (Only Signed Images).
Save your changes.
This setting propagates DOCKER_CONTENT_TRUST=1 to all cluster nodes.
Step 4: Pulling an Unsigned Image from a Client with Content Trust Enabled
On your local workstation using the UCP client bundle, Content Trust is now enforced:
Copy
Ask AI
[root@yogeshclientbundle ~]# ./docker image pull yogeshraheja/tomcatone:v1Error response from daemon: image or trust data does not exist for docker.io/yogeshraheja/tomcatone:v1
Disabling Content Trust exposes your environment to unsigned and potentially unverified images. Only unset if absolutely necessary.
To continue working with unsigned images temporarily:
Step 6: Signing the Image with Docker Content Trust
Docker Content Trust uses Notary to manage trust metadata. Below are the steps to import your keys, initialize trust for a repository, and sign an image.
Copy the private key into Docker’s trust directory and load it:
Copy
Ask AI
[root@yogeshclientbundle ~]# mkdir -p ~/.docker/trust[root@yogeshclientbundle ~]# cp key.pem ~/.docker/trust/[root@yogeshclientbundle ~]# ./docker trust key load --name yogeshraheja key.pemLoading key from "key.pem"...Enter passphrase for new yogeshraheja key with ID 97dd9b8:Repeat passphrase for new yogeshraheja key with ID 97dd9b8:Successfully imported key from key.pem
Authorize your user as a signer and initialize the repository’s trust data:
Copy
Ask AI
[root@yogeshclientbundle ~]# ./docker trust signer add --key cert.pub \ yogeshraheja \ 54.145.234.153/yogeshraheja/testimagesigningAdding signer "yogeshraheja" to 54.145.234.153/yogeshraheja/testimagesigning...Initializing signed repository for 54.145.234.153/yogeshraheja/testimagesigning...Enter passphrase for root key with ID 47caaa5:Enter passphrase for new repository key with ID faf8bd5:Repeat passphrase for new key with ID faf8bd5:Successfully initialized and added signer "yogeshraheja".
[root@yogeshclientbundle ~]# ./docker trust sign \ 54.145.234.153/yogeshraheja/testimagesigning:v1Enter passphrase for "yogeshraheja" key with ID 97dd9b8:Signed 1 tag for 54.145.234.153/yogeshraheja/testimagesigning:v1