Skip to content

Commit c7629bd

Browse files
committed
ENGDOCS-2382
1 parent bb23052 commit c7629bd

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

content/reference/compose-file/services.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,20 @@ cgroup_parent: m-executor-abcd
257257
command: bundle exec thin -p 3000
258258
```
259259

260-
The value can also be a list, in a manner similar to [Dockerfile](https://docs.docker.com/reference/dockerfile/#cmd):
260+
> [!NOTE]
261+
>
262+
> Unlike the `CMD` instruction of an image, the [shell-form syntax](https://docs.docker.com/reference/dockerfile/#shell-form) for `command`
263+
> does not implicitly run in the context of the [`SHELL` instruction](https://docs.docker.com/reference/dockerfile/#shell).
264+
>
265+
> If you expect the command to rely on features of a shell environment such as environment variables, then ensure the command is run within a shell:
266+
>
267+
> ```yaml
268+
> command: /bin/sh -c 'echo "hello $$HOSTNAME"'
269+
> ```
270+
>
271+
> When the `entrypoint` (or image `ENTRYPOINT`) is configured to run the shell instead, to ensure `command` is processed correctly you should use the exec-form described bellow.
272+
273+
The value can also be a list, in a manner similar to the [exec-form syntax](/reference/dockerfile.md#exec-form) used by the [Dockerfile](/reference/dockerfile.md#cmd):
261274

262275
```yaml
263276
command: [ "bundle", "exec", "thin", "-p", "3000" ]
@@ -766,6 +779,8 @@ extends:
766779
- `service`: Defines the name of the service being referenced as a base, for example `web` or `database`.
767780
- `file`: The location of a Compose configuration file defining that service.
768781

782+
#### Restrictions
783+
769784
When a service uses `extends`, it can also specify dependencies on other resources, an explicit `volumes` declaration for instance. However, it's important to note that `extends` does not automatically incorporate the target volume definition into the extending Compose file. Instead, you are responsible for ensuring that an equivalent resource exists for the service being extended to maintain consistency. Docker Compose verifies that a resource with the referenced ID is present within the Compose model.
770785

771786
Dependencies on other resources in an `extends` target can be:

0 commit comments

Comments
 (0)