create_service
Create a Docker Swarm service for replicated or global scheduling, rolling updates, and automatic restart across the swarm.
Instructions
Create a Swarm service; requires a swarm manager node.
Use this instead of run_container when you need replicated or global scheduling,
rolling updates, or automatic restart across the swarm. Common extra_kwargs keys:
name (str), env (list of "KEY=VAL"), mode ({"Replicated": {"Replicas": N}} or
{"Global": {}}), networks (list of network names/ids), endpoint_spec
({"Ports": [{"PublishedPort": 80, "TargetPort": 8080}]}), labels (dict),
restart_policy ({"Condition": "on-failure", "MaxAttempts": 3}),
resources ({"Limits": {"NanoCPUs": 500000000, "MemoryBytes": 134217728}}).
args: image - Image to run service tasks from (e.g. "nginx:alpine") command - Override the image's default command; string or list of strings extra_kwargs - Additional docker-py ServiceCollection.create keyword arguments returns: dict - The created service's attrs
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image | Yes | ||
| command | No | ||
| extra_kwargs | No |