Docker

Repository is not signed in docker build

19 September 2026 · 10 min read

Repository is not signed in docker build

Encountering the frustrating “Repository is not signed” error during a Docker build can halt your development process and leave you scratching your head. This error typically arises when Docker’s content trust feature is enabled, and it prevents you from pulling or using images that aren’t cryptographically signed by a trusted party. Content trust is designed to enhance security by ensuring image integrity and authenticity, preventing malicious actors from injecting compromised images into your workflow. This article provides a comprehensive guide to understanding the root causes of this error and implementing effective solutions to resolve it, ensuring a smooth and secure Docker build process. Whether you’re a seasoned Docker user or just starting out, this guide will provide you with the necessary knowledge and steps to troubleshoot and fix this common issue, allowing you to focus on building and deploying your applications with confidence.

Understanding Docker Content Trust and Image Signing

Docker Content Trust (DCT) is a security feature that uses digital signatures to ensure the integrity and authenticity of Docker images. When DCT is enabled, Docker clients verify that an image is signed by a trusted key before pulling or running it. This helps prevent man-in-the-middle attacks and ensures that you are using images from verified publishers. The “Repository is not signed” error indicates that the image you’re trying to use lacks a valid signature, causing Docker to refuse to proceed. This is a critical security measure, designed to protect your system from potentially harmful or compromised images. It is important to understand the implications of disabling content trust, as it reduces the security posture of your Docker environment.

Image signing involves using cryptographic keys to create a digital signature for a Docker image. This signature is then associated with the image in the Docker registry. When a Docker client attempts to pull the image with DCT enabled, it verifies the signature against a trusted key. If the signature is valid, the image is deemed trustworthy. If the signature is missing or invalid, the “Repository is not signed” error occurs. Public key infrastructure (PKI) plays a crucial role in managing these keys and ensuring their validity. Properly managing your signing keys and ensuring they are securely stored is paramount to maintaining the integrity of your Docker images. Docker’s official documentation provides a comprehensive overview of Content Trust and its implementation.

Different Docker registries have varying levels of support for DCT. Docker Hub, for example, supports image signing, but not all images are signed by default. Private registries may require additional configuration to enable DCT and image signing. It’s essential to check the documentation for your specific registry to understand how DCT is implemented and whether image signing is required or optional. The registry’s configuration directly impacts whether DCT checks are enforced during image pulls. For example, some organizations mandate signed images for all production deployments, adding a layer of security and compliance.

Diagnosing the “Repository is Not Signed” Error

The first step in resolving the “Repository is not signed” error is to accurately diagnose the cause. This involves checking several factors, including the Docker client configuration, the Docker registry settings, and the image itself. Start by verifying that DCT is enabled on your Docker client. You can do this by checking the DOCKER_CONTENT_TRUST environment variable. If it’s set to 1, DCT is enabled. If it’s not set or set to 0, DCT is disabled. Understanding your current configuration is crucial for accurate troubleshooting.

Next, verify the image you’re trying to pull is actually signed. Not all images in Docker Hub or other registries are signed. You can attempt to pull the image with DCT disabled to confirm that the image itself is available. If the pull succeeds with DCT disabled, but fails with it enabled, the issue is likely related to the lack of a valid signature. Also, check if the image tag you are trying to pull is a signed tag. Sometimes only specific tags are signed for security reasons. Consider using a different, potentially signed, tag if available. A common pitfall is assuming all tags within a repository are signed when only specific versions are.

Examine the error message closely. The error message often provides clues about the specific problem. For example, it might indicate that the trust key is missing or invalid. Check your local Docker environment for any issues related to key management. Ensure your keys are properly stored and accessible to the Docker client. Debugging tools, such as examining the Docker daemon logs, can also provide valuable insights into the cause of the error.

Solutions to Resolve the Signing Issue

There are several approaches to resolving the “Repository is not signed” error, each with its own trade-offs in terms of security and convenience. The most straightforward solution is to disable Docker Content Trust (DCT) on your Docker client. However, this reduces security by allowing you to pull unsigned images. Therefore, this should be considered a temporary solution or only used in trusted environments. Always evaluate the risks before disabling DCT.

If disabling DCT is not an option, you can try pulling a signed image from a trusted source. Docker Hub offers a variety of signed images from verified publishers. Look for images with the “Verified Publisher” badge to ensure they are signed and trustworthy. Using signed images is the preferred approach, as it maintains the security benefits of DCT. Also, consider building your own images and signing them with your own keys, providing complete control over the image’s provenance and integrity. Securely storing and managing these keys is extremely important.

If you’re using a private registry, you may need to configure it to support DCT and image signing. Refer to the registry’s documentation for instructions on how to enable these features. Once DCT is enabled, you can sign your images using the docker trust command. This involves generating a key pair and using the private key to sign the image. After signing, push the image to the registry. Be sure to distribute the public key to any users who need to verify the image’s signature. Understanding the key management lifecycle is essential for maintaining a secure and reliable Docker environment. Here’s how to sign an image:

  1. Generate a signing key: docker trust key generate my-signing-key
  2. Add the key to the registry: docker trust signer add –key my-signing-key.pub my-repo
  3. Sign the image: docker trust sign my-repo:latest

The “Repository is not signed” error in Docker build arises primarily due to Docker Content Trust (DCT) being enabled and the image lacking a valid digital signature. This security feature ensures image integrity and authenticity, preventing the use of potentially compromised or malicious images. Resolving this often involves either disabling DCT (not recommended for secure environments) or ensuring you’re using images signed by a trusted publisher. Using signed images is a key component of a secure Docker workflow.

Best Practices for Managing Docker Content Trust

Effectively managing Docker Content Trust requires a combination of technical configuration and organizational policy. Start by establishing a clear policy for image signing within your organization. Define which images require signing and who is authorized to sign them. Document these policies and communicate them to all developers and operations staff. Consistent application of the policy is crucial for maintaining a secure environment. Regularly review and update the policy as needed to address evolving threats and best practices.

Implement robust key management practices. Use strong passwords to protect your signing keys and store them securely. Consider using a hardware security module (HSM) to protect your keys. Regularly rotate your keys to minimize the impact of a potential compromise. Ensure that your key management practices comply with industry best practices and regulatory requirements. A compromised signing key can have significant security implications.

Educate your team about Docker Content Trust and its importance. Provide training on how to sign images, verify signatures, and troubleshoot common issues. Encourage developers to use signed images whenever possible. Promote a culture of security awareness and responsibility. A well-informed team is more likely to adhere to security policies and practices, reducing the risk of security incidents. This includes understanding the implications of disabling content trust even for seemingly minor tasks.

  • Enforce strict key management policies.
  • Regularly audit your image signing processes.
Infographic here showing a visual explanation of Docker Content Trust workflow
FAQ: Common Questions About Docker Content Trust ------------------------------------------------
**Q: What is Docker Content Trust (DCT)?**
A: Docker Content Trust (DCT) is a security feature that uses digital signatures to ensure the integrity and authenticity of Docker images.
**Q: Why am I getting the "Repository is not signed" error?**
A: This error occurs when Docker Content Trust is enabled and you're trying to pull an image that is not signed by a trusted party.
**Q: How do I disable Docker Content Trust?**
A: You can disable DCT by setting the DOCKER\_CONTENT\_TRUST environment variable to 0 or unsetting it.
**Q: How do I sign a Docker image?**
A: Use the docker trust command-line tool to generate a key pair, add a signer to the repository, and sign the image.
**Q: Is it safe to disable Docker Content Trust?**
A: Disabling DCT reduces security by allowing you to pull unsigned images. It's generally recommended to use signed images whenever possible.
- Docker Content Trust enhances security. - Proper key management is essential.

By understanding Docker Content Trust, diagnosing the “Repository is not signed” error, and implementing appropriate solutions, you can ensure a secure and reliable Docker build process. Remember to prioritize security by using signed images whenever possible and implementing robust key management practices. Implementing these steps allows you to build a more robust, secure, and streamlined containerization strategy. Don’t let unsigned repositories hinder your progress; take control of your Docker environment’s security today.

Now that you understand how to address this specific error, consider exploring other Docker security best practices. Learn about image scanning for vulnerabilities, network security policies, and runtime security monitoring. Improving your Docker security posture is an ongoing process, but the benefits are well worth the effort. Check out resources like OWASP’s Top Ten for web application security risks and how they apply to containerized environments. Furthermore, explore resources like Snyk’s blog post on Docker image security best practices to get a better understanding of potential vulnerabilities and how to mitigate them. Also, review Aqua Security’s best practices for a comprehensive approach to Docker security. Start securing your containers today!

Question & Answer :
I have the following Dockerfile that uses the latest Ubuntu image pulled from dockerhub:

FROM ubuntu:latest RUN apt-get update && apt-get install -y g++ llvm lcov 

when I launch the docker build command, the following errors occur:

Err:2 http://archive.ubuntu.com/ubuntu bionic InRelease At least one invalid signature was encountered. Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease At least one invalid signature was encountered. Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease At least one invalid signature was encountered. Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease At least one invalid signature was encountered. Reading package lists... W: GPG error: http://archive.ubuntu.com/ubuntu bionic InRelease: At least one invalid signature was encountered. E: The repository 'http://archive.ubuntu.com/ubuntu bionic InRelease' is not signed. W: GPG error: http://security.ubuntu.com/ubuntu bionic-security InRelease: At least one invalid signature was encountered. E: The repository 'http://security.ubuntu.com/ubuntu bionic-security InRelease' is not signed. W: GPG error: http://archive.ubuntu.com/ubuntu bionic-updates InRelease: At least one invalid signature was encountered. E: The repository 'http://archive.ubuntu.com/ubuntu bionic-updates InRelease' is not signed. W: GPG error: http://archive.ubuntu.com/ubuntu bionic-backports InRelease: At least one invalid signature was encountered. E: The repository 'http://archive.ubuntu.com/ubuntu bionic-backports InRelease' is not signed. 

I read here https://superuser.com/questions/1331936/how-can-i-get-past-a-repository-is-not-signed-message-when-attempting-to-upgr that you can pass this error using –allow-unauthenitcated or –allow-insecure-repositories but both seem to me workarounds that may compromize security of the container.

EDIT

Tried to pull ubuntu:18.04, ubuntu:19:04, ubuntu:19.10 same error with different distro name

Apparently my root partition was full (maybe I’ve tried too many times to download packages through apt), and running sudo apt clean solved the issue


In addition, the following commands should help clean up space:

docker system df # which can show disk usage and size of 'Build Cache' docker image prune # add -f or --force to not prompt for confirmation docker container prune # add -f or --force to not prompt for confirmation