Environmental Variables for Compose

Using Environmental Variables in Docker Compose files

Set Environmental Variables

sudo nano /etc/environment

Common Variables for Compose

/etc/environment
PUID=1000
PGID=1000
TZ="America/New_York"

Get UID and GID for desired user:

$ id [USERNAME]

Example in docker-compose.yaml

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

Last updated