StackCLI
deploy
deploy(name, compose_files=[], orchestrator=None, prune=False, resolve_image='always', with_registry_auth=False, env_files=[], variables={})
Deploys a stack.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The name of the stack to deploy. Mandatory. |
required |
compose_files |
Union[ValidPath, List[ValidPath]]
|
One or more docker-compose files. If there are more than one, they will be fused together. orchestrator: The orchestrator to use, `"swarm" or "kubernetes" or "all". |
[]
|
prune |
bool
|
Prune services that are no longer referenced |
False
|
resolve_image |
str
|
Query the registry to resolve image digest
and supported platforms |
'always'
|
with_registry_auth |
bool
|
Send registry authentication details to Swarm agents.
Required if you need to run |
False
|
env_files |
List[ValidPath]
|
Similar to |
[]
|
variables |
Dict[str, str]
|
A dict dictating by what to replace the variables declared in the docker-compose files. In the docker CLI, you would use environment variables for this. |
{}
|
Returns
A `python_on_whales.Stack` object.
list
list()
Returns a list of python_on_whales.Stack
Returns
A `List[python_on_whales.Stack]`.
ps
ps(x)
Returns the list of swarm tasks in this stack.
from python_on_whales import docker
tasks = docker.stack.ps("my-stack")
print(tasks[0].desired_state)
# running
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ValidStack
|
A stack . It can be name or a |
required |
Returns
`List[python_on_whales.Task]`
remove
remove(x)
Removes one or more stacks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Union[ValidStack, List[ValidStack]]
|
One or more stacks, empty list means nothing will be done. |
required |
services
services(stack)
List the services present in the stack.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stack |
ValidStack
|
A docker stack or the name of a stack. |
required |
Returns
A `List[python_on_whales.Stack]`