Hardening and Improving Container Security

Hardening a container involves implementing security measures to reduce its attack surface and enhance its resilience against potential threats. In this section we have listed techinques commonly used to harden containers. This list is not comprehensive and container security will depend on your oranization’s infrastructure.

For more information, see Security and Hardening Guide.

1. Use Minimal Base Images

SUSE Manager 5.0 uses SLE Micro 5.5 as its base. This image has fewer pre-installed packages, thus reducing the potential attack surface.

Reduced Size

Minimal base images are significantly smaller in size compared to classical operating system images. By removing unnecessary packages and libraries, these images minimize the overall footprint, leading to faster download times and reduced storage requirements.

Focused Functionality

Minimal base images are designed to provide the essential functionalities needed for running containerized applications. Minimal base images typically include:

  • core system utilities

  • runtime environments (such as the shell)

  • essential libraries

    Minimal base images typically exclude non-essential components such as:

  • documentation

  • development tools

  • unnecessary daemons

Improved Security

By minimizing the number of installed packages and dependencies, minimal base images reduce the attack surface and potential vulnerabilities within the container environment. This enhances security by limiting the avenues through which malicious actors can exploit the system.


Minimal base images offer greater flexibility for developers to customize and optimize their containerized applications. Since these images contain only the basic necessities, developers have more control over which additional components and dependencies to include, tailoring the container environment to meet specific application requirements.

2. Update Regularly

Keep container images up to date with security patches and updates. Regularly scan container images for vulnerabilities using tools like:

3. Enable Image Signing

Use digital signatures to verify the authenticity and integrity of container images. Implement image signing and verification mechanisms to ensure that only trusted images are deployed.

Digital Signatures

A digital signature is a cryptographic mechanism used to validate the authenticity and integrity of digital content, such as container images. It involves generating a unique hash or checksum of the image content and encrypting it with a private key to produce a signature. This signature can be decrypted using a corresponding public key to verify its authenticity.

Private and Public Keys

Image signing relies on asymmetric encryption, which involves the use of a pair of cryptographic keys: a private key and a public key. The private key is used to generate the signature, while the public key is used to verify the signature. The private key is kept confidential and securely stored, while the public key can be freely distributed.

Trust Model

Image signing establishes a trust model where the signer of the image is implicitly trusted to vouch for its authenticity. Organizations typically maintain their own private key for signing images, and users trust images signed by that organization’s key. Image consumers can verify the signature using the corresponding public key to ensure that the image has not been compromised or altered by malicious actors.

Registry Integration

Image signing is often integrated with container image registries, such as Docker Hub or private registries like Harbor. Registries may offer built-in support for image signing, allowing users to sign and verify images directly within the registry platform. Signed images are typically tagged with metadata indicating their signed status and the identity of the signer.

Verification Process

Before deploying a container image, the image consumer (for example, a container runtime or orchestration platform) verifies the image signature using the signer’s public key. If the signature is valid and matches the image content, the image is considered authentic and can be safely deployed. If the signature cannot be verified or does not match the image content, the image is rejected to prevent potential security risks.

4. Implement User Privileges

Run containers with the least privilege principle. Avoid running containers as root whenever possible. Instead, create, and use non-root users within containers to limit the impact of potential exploits.

5. Use Security Contexts

Leverage security features provided by container runtimes such as Podman. Configure security contexts to enforce resource limitations, network policies, and SELinux/AppArmor profiles.

6. Network Segmentation

Implement network segmentation to isolate containers from each other and from the host system. Use container network plugins or overlay networks to enforce network policies and restrict container communications.

7. Monitor Runtime Activity

Employ container runtime monitoring tools to detect and respond to suspicious activities in real-time. Monitor container logs, file integrity, and system calls for signs of compromise or malicious behavior.

8. Limit Container Capabilities

Disable unnecessary Linux capabilities within containers to reduce the potential impact of privilege escalation attacks. Use tools like capsh to drop or restrict capabilities as needed.

9. Secure Host Environment

Ensure that the underlying host system is properly secured. Apply operating system patches, configure firewall rules, and implement access controls to protect the host from external threats.

10. Implement Runtime Protection

Use runtime protection mechanisms such as seccomp or AppArmor profiles to restrict the actions that container processes can perform. Define and enforce granular security policies to prevent unauthorized access or execution of malicious code.