> For the complete documentation index, see [llms.txt](https://strangebutohwell.gitbook.io/knowledge/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://strangebutohwell.gitbook.io/knowledge/docker/docker-compose/environmental-variables-for-compose.md).

# Environmental Variables for Compose

Using Environmental Variables in Docker Compose files

## Set Environmental Variables

`sudo nano /etc/environment`

## Common Variables for Compose

{% code title="/etc/environment" %}

```bash
PUID=1000
PGID=1000
TZ="America/New_York"
```

{% endcode %}

{% hint style="info" %}
**Get UID and GID for desired user:**

`$ id [USERNAME]`
{% endhint %}

## Example in docker-compose.yaml

{% code title="docker-compose.yaml" %}

```yaml
  headphones:
    image: linuxserver/headphones
    container_name: headphones
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
```

{% endcode %}
