From be37ddd5576aa3c8e215cb87cd2cdeb97865e2cf Mon Sep 17 00:00:00 2001 From: Suraj Narwade Date: Thu, 20 Apr 2017 03:35:02 +0530 Subject: [PATCH] Adding documentation for restart policy (#2912) Resolves #1353 --- compose/compose-file/compose-file-v2.md | 12 +++++++++--- compose/compose-file/index.md | 11 +++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/compose/compose-file/compose-file-v2.md b/compose/compose-file/compose-file-v2.md index 4fcf04c316..306c72e4d0 100644 --- a/compose/compose-file/compose-file-v2.md +++ b/compose/compose-file/compose-file-v2.md @@ -902,7 +902,15 @@ then read-write will be used. > - container_name > - container_name:rw -### cpu\_shares, cpu\_quota, cpuset, domainname, hostname, ipc, mac\_address, mem\_limit, memswap\_limit, mem\_swappiness, mem\_reservation, oom_score_adj, privileged, read\_only, restart, shm\_size, stdin\_open, tty, user, working\_dir +### restart + +`no` is the default restart policy, and it will not restart a container under any circumstance. When `always` is specified, the container always restarts. The `on-failure` policy restarts a container if the exit code indicates an on-failure error. + + - restart: no + - restart: always + - restart: on-failure + +### cpu\_shares, cpu\_quota, cpuset, domainname, hostname, ipc, mac\_address, mem\_limit, memswap\_limit, mem\_swappiness, mem\_reservation, oom_score_adj, privileged, read\_only, shm\_size, stdin\_open, tty, user, working\_dir Each of these is a single value, analogous to its [docker run](/engine/reference/run.md) counterpart. @@ -926,8 +934,6 @@ Each of these is a single value, analogous to its oom_score_adj: 500 - restart: always - read_only: true shm_size: 64M stdin_open: true diff --git a/compose/compose-file/index.md b/compose/compose-file/index.md index ec8f673280..8412f00102 100644 --- a/compose/compose-file/index.md +++ b/compose/compose-file/index.md @@ -1210,12 +1210,20 @@ volumes: target: /opt/app/static ``` +### restart + +`no` is the default restart policy, and it will not restart a container under any circumstance. When `always` is specified, the container always restarts. The `on-failure` policy restarts a container if the exit code indicates an on-failure error. + + - restart: no + - restart: always + - restart: on-failure + > **Note:** The long syntax is new in v3.2 See [Docker Volumes](/engine/userguide/dockervolumes.md) and [Volume Plugins](/engine/extend/plugins_volume.md) for more information. -### domainname, hostname, ipc, mac\_address, privileged, read\_only, restart, shm\_size, stdin\_open, tty, user, working\_dir +### domainname, hostname, ipc, mac\_address, privileged, read\_only, shm\_size, stdin\_open, tty, user, working\_dir Each of these is a single value, analogous to its [docker run](/engine/reference/run.md) counterpart. @@ -1230,7 +1238,6 @@ Each of these is a single value, analogous to its privileged: true - restart: always read_only: true shm_size: 64M