Secrets
Manage secrets on the server.
Methods available on client.secrets
:
-
class SecretCollection
-
create(**kwargs)
Create a secret
- Parameters:
name (string) – Name of the secret
data (bytes) – Secret data to be stored
labels (dict) – A mapping of labels to assign to the secret
driver (DriverConfig) – A custom driver configuration. If
unspecified, the default internal
driver will be used
Returns (dict): ID of the newly created secret
-
get(secret_id)
Get a secret.
- Parameters:
secret_id (str) – Secret ID.
- Returns:
The secret.
- Return type:
(Secret
)
- Raises:
-
-
list(**kwargs)
List secrets. Similar to the docker secret ls
command.
- Parameters:
filters (dict) – Server-side list filtering options.
- Returns:
The secrets.
- Return type:
(list of Secret
)
- Raises:
docker.errors.APIError – If the server returns an error.
Secret objects
-
class Secret
A secret.
-
id
The ID of the object.
-
name
-
attrs
The raw representation of this object from the server.
-
reload()
Load this object from the server again and update attrs
with the
new data.
-
remove()
Remove this secret.
- Raises:
docker.errors.APIError – If secret failed to remove.