title: share env variables between 2 containers from docker-compose
body: <p>In my docker-compose, I have 2 containers, php-container, and nginx container. For nginx container I defined env variable, is there a way to access that variable in php container in code? I want to access in php code the PLAYER_NAME variable</p>
  
  <pre><code>version: '3.7'
  
  services:
    api:
      build: '.'
      volumes:
        - './:/srv/api:rw'
      env_file:
        - .env
      networks:
        - backend
  
    nginx_player_1:
      image: 'nginx:1.15.7-alpine'
      depends_on:
        - api
      volumes:
        - './docker/nginx/conf.d:/etc/nginx/conf.d:ro'
        - './:/srv/api:rw'
      ports:
        - '8001:80'
      environment:
        PLAYER_NAME: 'PLAYER_1'
      networks:
        - backend
  </code></pre>