How to enable Docker Content Trust?

QuestionsQuestions8 SkillsProYour First Docker LabNov, 27 2025
0108

To enable Docker Content Trust, you need to set the DOCKER_CONTENT_TRUST environment variable to 1. Here’s how you can do it:

For Linux or macOS:

You can enable it in your terminal session by running:

export DOCKER_CONTENT_TRUST=1

For Windows (Command Prompt):

You can set it using:

set DOCKER_CONTENT_TRUST=1

For Windows (PowerShell):

You can set it using:

$env:DOCKER_CONTENT_TRUST=1

Persistent Setting:

To make this setting persistent across sessions, you can add the export command to your shell's configuration file (like .bashrc, .bash_profile, or .zshrc for Linux/macOS) or set it in your system environment variables on Windows.

Verification:

Once enabled, any subsequent docker pull or docker push commands will enforce content trust. If you try to pull an image that is not signed, Docker will reject the operation.

To disable content trust, you can set the variable to 0:

export DOCKER_CONTENT_TRUST=0

This will allow you to pull unsigned images again.

0 Comments

no data
Be the first to share your comment!