Environment variable in compose file doesn't end up in running container

I have this in a docker compose file:

services:

  rna-nsd-lan:
    image: rna-nameserver-base
    build:
      context: .
      dockerfile: Dockerfile
      network: host
      tags:
        - "rna-nameserver-base"
    container_name: rna-nsd-lan
    environment:
      - TZ=Europe/Amsterdam
    volumes:
      - ./etc/nsd-lan:/etc/nsd:ro
      - /mnt/ServerData/var/log/nsd-lan:/var/log/nsd
    restart: unless-stopped
    ports:
      - 1054:1054/tcp
      - 1054:1054/udp
    networks:
      rna-fixed-internal:
        ipv4_address: [snip]
      rna-docker-exposed: null
    entrypoint:
      - /usr/sbin/nsd
      - "-V"
      - "2"
      - "-d"

But when I inspect the container, the TZ environment isn’t there:

docker exec -i -t rna-mailserver /bin/sh

/ # env
HOSTNAME=0f68712ea757
SHLVL=1
HOME=/root
TERM=xterm
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/

Why?

You are creating a container named rna-nsd-lan, and test if changes to that container apply, by testing it on a different container… Can you explain how and why this makes sense?

Oh sorry, all containers have the same problem and I mixed one compose with another test.

root@snape:/srv/docker# docker exec -i -t rna-nsd-lan /bin/sh
/ # env
HOSTNAME=0f68712ea757
SHLVL=1
HOME=/root
TERM=xterm
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/