diff --git a/compose/compose-file/index.md b/compose/compose-file/index.md index 91126787fd..574dba6404 100644 --- a/compose/compose-file/index.md +++ b/compose/compose-file/index.md @@ -222,7 +222,7 @@ When the value supplied is a relative path, it is interpreted as relative to the location of the Compose file. This directory is also the build context that is sent to the Docker daemon. -Compose builds and tags it with a generated name, and use that image +Compose builds and tags it with a generated name, and uses that image thereafter. build: @@ -296,7 +296,7 @@ A list of images that the engine uses for cache resolution. Add metadata to the resulting image using [Docker labels](/engine/userguide/labels-custom-metadata.md). You can use either an array or a dictionary. -It's recommended that you use reverse-DNS notation to prevent your labels from conflicting with +We recommend that you use reverse-DNS notation to prevent your labels from conflicting with those used by other software. build: @@ -359,6 +359,16 @@ See `man 7 capabilities` for a full list. > [deploying a stack in swarm mode](/engine/reference/commandline/stack_deploy.md) > with a (version 3) Compose file. +### cgroup_parent + +Specify an optional parent cgroup for the container. + + cgroup_parent: m-executor-abcd + +> **Note**: This option is ignored when +> [deploying a stack in swarm mode](/engine/reference/commandline/stack_deploy.md) +> with a (version 3) Compose file. + ### command Override the default command. @@ -464,16 +474,6 @@ configs: You can grant a service access to multiple configs and you can mix long and short syntax. Defining a config does not imply granting a service access to it. -### cgroup_parent - -Specify an optional parent cgroup for the container. - - cgroup_parent: m-executor-abcd - -> **Note**: This option is ignored when -> [deploying a stack in swarm mode](/engine/reference/commandline/stack_deploy.md) -> with a (version 3) Compose file. - ### container_name Specify a custom container name, rather than a generated default name. @@ -490,14 +490,14 @@ an error. ### credential_spec -> **Note:** this option was added in v3.3 +> **Note:** this option was added in v3.3. Configure the credential spec for managed service account. This option is only used for services using Windows containers. The `credential_spec` must be in the format `file://` or `registry://`. When using `file:`, the referenced file must be present in the `CredentialSpecs` -subdirectory in the docker data directory, which defaults to `C:\ProgramData\Docker\` +subdirectory in the Docker data directory, which defaults to `C:\ProgramData\Docker\` on Windows. The following example loads the credential spec from a file named `C:\ProgramData\Docker\CredentialSpecs\my-credential-spec.json`: @@ -515,6 +515,45 @@ in the registry: credential_spec: registry: my-credential-spec +### depends_on + +Express dependency between services, Service dependencies cause the following +behaviors: + +- `docker-compose up` starts services in dependency order. In the following + example, `db` and `redis` are started before `web`. + +- `docker-compose up SERVICE` automatically includes `SERVICE`'s + dependencies. In the following example, `docker-compose up web` also + creates and starts `db` and `redis`. + +Simple example: + + version: '3' + services: + web: + build: . + depends_on: + - db + - redis + redis: + image: redis + db: + image: postgres + +> There are several things to be aware of when using `depends_on`: +> +> - `depends_on` does not wait for `db` and `redis` to be "ready" before +> starting `web` - only until they have been started. If you need to wait +> for a service to be ready, see [Controlling startup order](/compose/startup-order.md) +> for more on this problem and strategies for solving it. +> +> - Version 3 no longer supports the `condition` form of `depends_on`. +> +> - The `depends_on` option is ignored when +> [deploying a stack in swarm mode](/engine/reference/commandline/stack_deploy.md) +> with a version 3 Compose file. + ### deploy > **[Version 3](compose-versioning.md#version-3) only.** @@ -546,7 +585,7 @@ Specify a service discovery method for external clients connecting to a swarm. > **[Version 3.3](compose-versioning.md#version-3) only.** * `endpoint_mode: vip` - Docker assigns the service a virtual IP (VIP) -that acts as the “front end” for clients to reach the service on a +that acts as the front end for clients to reach the service on a network. Docker routes requests between the client and available worker nodes for the service, without client knowledge of how many nodes are participating in the service or their IP addresses or ports. @@ -883,7 +922,6 @@ Simple example: > [deploying a stack in swarm mode](/engine/reference/commandline/stack_deploy.md) > with a version 3 Compose file. - ### dns Custom DNS servers. Can be a single value or a list. @@ -902,31 +940,6 @@ Custom DNS search domains. Can be a single value or a list. - dc1.example.com - dc2.example.com -### tmpfs - -> [Version 2 file format](compose-versioning.md#version-2) and up. - -Mount a temporary file system inside the container. Can be a single value or a list. - - tmpfs: /run - tmpfs: - - /run - - /tmp - -> **Note**: This option is ignored when -> [deploying a stack in swarm mode](/engine/reference/commandline/stack_deploy.md) -> with a (version 3-3.5) Compose file. - -> [Version 3.6 file format](compose-versioning.md#version-3) and up. - -Mount a temporary file system inside the container. Size parameter specifies the size -of the tmpfs mount in bytes. Unlimited by default. - - - type: tmpfs - target: /app - tmpfs: - size: 1000 - ### entrypoint Override the default entrypoint. @@ -1462,6 +1475,22 @@ ports: > **Note:** The long syntax is new in v3.2 +### restart + +`no` is the default restart policy, and it does 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 + restart: unless-stopped + +> **Note**: This option is ignored when +> [deploying a stack in swarm mode](/engine/reference/commandline/stack_deploy.md) +> with a (version 3) Compose file. Use [restart_policy](#restart_policy) instead. + ### secrets Grant access to secrets on a per-service basis using the per-service `secrets` @@ -1608,6 +1637,31 @@ dictionary. > [deploying a stack in swarm mode](/engine/reference/commandline/stack_deploy.md) > with a (version 3) Compose file. +### tmpfs + +> [Version 2 file format](compose-versioning.md#version-2) and up. + +Mount a temporary file system inside the container. Can be a single value or a list. + + tmpfs: /run + tmpfs: + - /run + - /tmp + +> **Note**: This option is ignored when +> [deploying a stack in swarm mode](/engine/reference/commandline/stack_deploy.md) +> with a (version 3-3.5) Compose file. + +> [Version 3.6 file format](compose-versioning.md#version-3) and up. + +Mount a temporary file system inside the container. Size parameter specifies the size +of the tmpfs mount in bytes. Unlimited by default. + + - type: tmpfs + target: /app + tmpfs: + size: 1000 + ### ulimits Override the default ulimits for a container. You can either specify a single @@ -1831,22 +1885,6 @@ Full detail on these flags, the problems they solve, and their `docker run` counterparts is in the Docker for Mac topic [Performance tuning for volume mounts (shared filesystems)](/docker-for-mac/osxfs-caching.md). -### restart - -`no` is the default restart policy, and it does 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 - restart: unless-stopped - -> **Note**: This option is ignored when -> [deploying a stack in swarm mode](/engine/reference/commandline/stack_deploy.md) -> with a (version 3) Compose file. Use [restart_policy](#restart_policy) instead. - ### 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