Skip to content

Commit 7479d4c

Browse files
committed
added documentation for restart policy
1 parent a1168c8 commit 7479d4c

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Identical to the `docker search` command.
232232
```python
233233
c.start(container, binds=None, port_bindings=None, lxc_conf=None,
234234
publish_all_ports=False, links=None, privileged=False,
235-
dns=None, dns_search=None, volumes_from=None, network_mode=None)
235+
dns=None, dns_search=None, volumes_from=None, network_mode=None, restart_policy=None)
236236
```
237237

238238
Similar to the `docker start` command, but doesn't support attach
@@ -258,6 +258,27 @@ docker bridge, 'none': no networking for this container, 'container:[name|id]':
258258
reuses another container network stack), 'host': use the host network stack
259259
inside the container.
260260

261+
`restart_policy` is available since v1.2.0 and sets the RestartPolicy for how a container should or should not be
262+
restarted on exit. By default the policy is set to no meaning do not restart the container when it exits.
263+
The user may specify the restart policy as a dictionary for example:
264+
for example:
265+
```
266+
{
267+
"MaximumRetryCount": 0,
268+
"Name": "always"
269+
}
270+
```
271+
for always restarting the container on exit or can specify to restart the container to restart on failure and can limit
272+
number of restarts.
273+
for example:
274+
```
275+
{
276+
"MaximumRetryCount": 5,
277+
"Name": "on-failure"
278+
}
279+
```
280+
281+
261282
```python
262283
c.stop(container, timeout=10)
263284
```

0 commit comments

Comments
 (0)