Docker in production: limit the damage if an application is attacked
A Docker container is like a home in a building: the application has its space, but certain foundations are common. For Linux containers on the same host, the kernel is shared. A bad configuration can therefore have consequences beyond a single application.
A container does not protect against all attacks. The goal is to limit what a compromised program could achieve, while still maintaining a usable service.

Each application has its space, but Linux containers on the same host share its kernel. Limiting rights helps reduce the consequences of an attack; this does not guarantee absolute insulation.
Choose and maintain the image
The image is the package that contains the application and its dependencies. Choose an identified source and a maintained version. Note precisely what is deployed; prepare updates and verify that new images are actually released into production after testing.
A scan result must be analyzed: which component is affected, is it used, is there a correction? “No alerts” is not a guarantee of absence of vulnerability.
Reduce container powers
Docker documentation emphasizes engine rights and container privileges. Controlling the Docker engine can give very broad access to the host machine.
So avoid providing its control socket to an ordinary application. Run the program with an unprivileged user when compatible and only give it the necessary capabilities. Maintain the containment protections appropriate for your platform.
Set memory and CPU limits. They help contain an application that consumes too many resources; they do not correct a data leak.
Separate application, data and secrets
Our TJEH advice: ask three questions before each deployment. Where is the data to be stored? Where are the sensitive identifiers? What do we lose if the container disappears?
Keep secrets out of code and image, with proper injection mechanism and permissions. Back up persistent data and verify its recovery. An easy-to-recreate container does not automatically make data recoverable.
A volume mounted as read-only protects that volume from container writes; this does not make its entire filesystem read-only.
Do a test before generalizing
On a test copy, check the useful functions after each restriction: startup, write allowed, connection to the database and restart. Prepare a rollback to the previous version taking into account data migrations.
Official source
Docker: Engine Security Model.
Documentation accessed October 28, 2026. Protections depend on host system and deployment mode.