docker stack
StackCLI
deploy
deploy(name, compose_files=[], orchestrator=None, prune=False, resolve_image='always', with_registry_auth=False, env_files=[], variables={})
Deploys a stack.
PARAMETER | DESCRIPTION |
---|---|
name |
The name of the stack to deploy. Mandatory.
TYPE:
|
compose_files |
One or more docker-compose files. If there are more than one, they will be fused together.
TYPE:
|
orchestrator |
The orchestrator to use, `"swarm" or "kubernetes" or "all".
TYPE:
|
prune |
Prune services that are no longer referenced
TYPE:
|
resolve_image |
Query the registry to resolve image digest
and supported platforms
TYPE:
|
with_registry_auth |
Send registry authentication details to Swarm agents.
Required if you need to run
TYPE:
|
env_files |
Similar to
TYPE:
|
variables |
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.
TYPE:
|
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
PARAMETER | DESCRIPTION |
---|---|
x |
A stack . It can be name or a
TYPE:
|
Returns
`List[python_on_whales.Task]`
remove
remove(x)
Removes one or more stacks.
PARAMETER | DESCRIPTION |
---|---|
x |
One or more stacks, empty list means nothing will be done.
TYPE:
|
services
services(stack)
List the services present in the stack.
PARAMETER | DESCRIPTION |
---|---|
stack |
A docker stack or the name of a stack.
TYPE:
|
Returns
A `List[python_on_whales.Stack]`