Skip to content

ConfigCLI

create

create(name, file, labels={}, template_driver=None)

Create a config from a file

See the docker docs for more information about swarm configs.

Parameters:

Name Type Description Default
name str

The config name.

required
file Union[str, Path]

Tbe file to be used as config.

required
labels Dict[str, str]

The labels to add to the config

{}
template_driver Optional[str]

The template driver

None

Returns

A `python_on_whales.Config` object.

inspect

inspect(x)

Returns a python_on_whales.Config object based on its name or id.

Argument

x: An id or name or a list of ids/names.

Returns

A `python_on_whales.Config` if a string was passed as argument. A
`List[python_on_whales.Config]` if a list of strings was passed as argument.

list

list(filters={})

List all config available in the swarm.

Parameters:

Name Type Description Default
filters Dict[str, str]

If you want to filter the results based on a given condition. For example, docker.config.list(filters=dict(label="my_label=hello")).

{}

Returns

A `List[python_on_whales.Config]`.

remove

remove(x)

Remove one or more configs.

Parameters:

Name Type Description Default
x Union[ValidConfig, List[ValidConfig]]

One or a list of configs. Valid values are the id of the config or a python_on_whales.Config object. An empty list means the function call does nothing.

required