wauth.drivers.docker module

Docker driver for reading container-injected secrets.

Reads secrets from the filesystem path used by Docker Swarm or Docker Compose secret management (/run/secrets by default).

class wauth.drivers.docker.DockerDriver(secrets_path='/run/secrets')[source]

Bases: object

Driver for reading secrets from a Docker container’s filesystem.

Docker injects secrets as files under /run/secrets. This driver reads from that path when running inside a container.

Note

This driver is read-only. Writing secrets is handled by LocalDriver.

Parameters:

secrets_path (str) – Base path where Docker secrets are mounted. Defaults to /run/secrets.

__init__(secrets_path='/run/secrets')[source]
get_secret(key)[source]

Read a secret from the Docker secrets filesystem.

Parameters:

key (str) – Name of the secret (corresponds to filename).

Returns:

Stripped secret content, or None if not found.

Return type:

str | None

is_docker()[source]

Check if the process is running inside a Docker container.

Returns:

True if Docker indicators are present in the filesystem.

Return type:

bool