Skip to content

Commit

Permalink
ENGDOCS-2382
Browse files Browse the repository at this point in the history
  • Loading branch information
aevesdocker committed Jan 17, 2025
1 parent bb23052 commit c7629bd
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion content/reference/compose-file/services.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,20 @@ cgroup_parent: m-executor-abcd
command: bundle exec thin -p 3000
```

The value can also be a list, in a manner similar to [Dockerfile](https://docs.docker.com/reference/dockerfile/#cmd):
> [!NOTE]
>
> Unlike the `CMD` instruction of an image, the [shell-form syntax](https://docs.docker.com/reference/dockerfile/#shell-form) for `command`
> does not implicitly run in the context of the [`SHELL` instruction](https://docs.docker.com/reference/dockerfile/#shell).
>
> 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:
>
> ```yaml
> command: /bin/sh -c 'echo "hello $$HOSTNAME"'
> ```
>
> 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.

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):

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

#### Restrictions

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.

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

0 comments on commit c7629bd

Please sign in to comment.