Configs

Manage configs on the server.

Methods available on client.configs:

class ConfigCollection
create(**kwargs)

Create a config

Parameters
  • name (string) – Name of the config

  • data (bytes) – Config data to be stored

  • labels (dict) – A mapping of labels to assign to the config

  • templating (dict) – dictionary containing the name of the templating driver to be used expressed as { name: <templating_driver_name>}

Returns (dict): ID of the newly created config

get(config_id)

Get a config.

Parameters

config_id (str) – Config ID.

Returns

The config.

Return type

(Config)

Raises
  • docker.errors.NotFound – If the config does not exist.

  • docker.errors.APIError – If the server returns an error.

list(**kwargs)

List configs. Similar to the docker config ls command.

Parameters

filters (dict) – Server-side list filtering options.

Returns

The configs.

Return type

(list of Config)

Raises

docker.errors.APIError – If the server returns an error.

Config objects

class Config

A config.

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 config.

Raises

docker.errors.APIError – If config failed to remove.