- "com.example.label-with-empty-value"
```
Compose creates containers with canonical labels:
- `com.docker.compose.project` set on all resources created by Compose to the user project name
- `com.docker.compose.service` set on service containers with service name as defined in the Compose file
The `com.docker.compose` label prefix is reserved. Specifying labels with this prefix in the Compose file
results in a runtime error.
### `label_file`
{{< summary-bar feature_name="Compose label file" >}}
The `label_file` attribute lets you load labels for a service from an external file or a list of files. This provides a convenient way to manage multiple labels without cluttering the Compose file.
The file uses a key-value format, similar to `env_file`. You can specify multiple files as a list. When using multiple files, they are processed in the order they appear in the list. If the same label is defined in multiple files, the value from the last file in the list overrides earlier ones.
```yaml
services:
one:
label_file: ./app.labels
two:
label_file:
- ./app.labels
- ./additional.labels
```
If a label is defined in both the `label_file` and the `labels` attribute, the value in [labels](#labels) takes precedence.
### `links`
`links` defines a network link to containers in another service. Either specify both the service name and
a link alias (`SERVICE:ALIAS`), or just the service name.
```yml
web:
links:
- db
- db:database
- redis
```
Containers for the linked service are reachable at a hostname identical to the alias, or the service name
if no alias is specified.
Links are not required to enable services to communicate. When no specific network configuration is set,
any service is able to reach any other service at that service’s name on the `default` network.
If services specify the networks they are attached to, `links` does not override the network configuration. Services that are not connected to a shared network are not be able to communicate with each other. Compose doesn't warn you about a configuration mismatch.
Links also express implicit dependency between services in the same way as
[`depends_on`](#depends_on), so they determine the order of service startup.
### `logging`
`logging` defines the logging configuration for the service.
```yml
logging:
driver: syslog
options:
syslog-address: "tcp://192.168.0.42:123"
```
The `driver` name specifies a logging driver for the service's containers. The default and available values
are platform specific. Driver specific options can be set with `options` as key-value pairs.
### `mac_address`
> Available with Docker Compose version 2.24.0 and later.
`mac_address` sets a Mac address for the service container.
> [!NOTE]
> Container runtimes might reject this value, for example Docker Engine >= v25.0. In that case, you should use [networks.mac_address](#mac_address) instead.
### `mem_limit`
`mem_limit` configures a limit on the amount of memory a container can allocate, set as a string expressing a [byte value](extension.md#specifying-byte-values).
When set, `mem_limit` must be consistent with the `limits.memory` attribute in the [Deploy Specification](deploy.md#memory).
### `mem_reservation`
`mem_reservation` configures a reservation on the amount of memory a container can allocate, set as a string expressing a [byte value](extension.md#specifying-byte-values).
When set, `mem_reservation` must be consistent with the `reservations.memory` attribute in the [Deploy Specification](deploy.md#memory).
### `mem_swappiness`
`mem_swappiness` defines as a percentage, a value between 0 and 100, for the host kernel to swap out
anonymous memory pages used by a container.
- `0`: Turns off anonymous page swapping.
- `100`: Sets all anonymous pages as swappable.
The default value is platform specific.
### `memswap_limit`
`memswap_limit` defines the amount of memory the container is allowed to swap to disk. This is a modifier