title: `docker-compose up` vs. `docker compose up` with environment variables
body: <p>I'm trying to deploy a three-node Elasticsearch cluster to an Azure Container Instance using Docker Compose. I'm loosely following <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-compose-file" rel="nofollow noreferrer">this example</a> from the Elasticsearch documentation and <a href="https://docs.microsoft.com/en-au/azure/container-instances/tutorial-docker-compose" rel="nofollow noreferrer">this tutorial</a> from the ACI documentation.</p>
  <p>When I try to deploy to ACI using the standard <code>docker-compose</code> command I see in most documentation, I get an error saying that it's not supported:</p>
  <pre><code>&gt; docker-compose -f .\docker-compose.yml -f .\docker-compose.production.yml up
  ERROR: The platform targeted with the current context is not supported.
  Make sure the context in use targets a Docker Engine.
  </code></pre>
  <p>When I try to deploy to ACI using the <code>docker compose</code> (no hyphen) command from the ACI documentation, I get an error because it's not loading the environment variables from the <strong>.env</strong> file:</p>
  <pre><code>&gt; docker compose -f .\docker-compose.yml -f .\docker-compose.production.yml up
  1 error(s) decoding:
  
  * error decoding 'Volumes[1]': invalid spec: certs:: empty section between colons
  </code></pre>
  <p>Is there a way to load the <strong>.env</strong> file when using <code>docker compose</code>, or use <code>docker-compose</code> with ACI? I don't fully understand where the <code>docker compose</code> command comes from and why it's different to <code>docker-compose</code>, it doesn't seem to be a standard <code>docker</code> command or a CLI extension that I can see.</p>
  <p>These are the relevant files:</p>
  <p>docker-compose.yml</p>
  <pre class="lang-yaml prettyprint-override"><code># Based on example from Elasticsearch documentation:
  # https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker
  
  version: '3.8'
  services:
  
    es01:
      image: docker.elastic.co/elasticsearch/elasticsearch:7.10.0
      container_name: es01
      environment:
        - node.name=es01
        - cluster.name=es-docker-cluster
        - discovery.seed_hosts=es02,es03
        - cluster.initial_master_nodes=es01,es02,es03
        - ELASTIC_PASSWORD=$ELASTIC_PASSWORD 
        - bootstrap.memory_lock=true
        - &quot;ES_JAVA_OPTS=-Xms512m -Xmx512m&quot;
        - xpack.security.enabled=true
        - xpack.security.http.ssl.enabled=true
        - xpack.security.http.ssl.key=$CERTS_DIR/es01/es01.key
        - xpack.security.http.ssl.certificate_authorities=$CERTS_DIR/ca/ca.crt
        - xpack.security.http.ssl.certificate=$CERTS_DIR/es01/es01.crt
        - xpack.security.transport.ssl.enabled=true
        - xpack.security.transport.ssl.verification_mode=certificate 
        - xpack.security.transport.ssl.certificate_authorities=$CERTS_DIR/ca/ca.crt
        - xpack.security.transport.ssl.certificate=$CERTS_DIR/es01/es01.crt
        - xpack.security.transport.ssl.key=$CERTS_DIR/es01/es01.key
      volumes:
        - data01:/usr/share/elasticsearch/data
        - 'certs:$CERTS_DIR'
      ports:
        - 127.0.0.1:9200:9200
      networks:
        - elastic
      healthcheck:
        test: curl --cacert $CERTS_DIR/ca/ca.crt -s https://localhost:9200 &gt;/dev/null; if [[ $$? == 52 ]]; then echo 0; else echo 1; fi
        interval: 30s
        timeout: 10s
        retries: 5
      ulimits:
        memlock:
          soft: -1
          hard: -1
      
    es02:
      image: docker.elastic.co/elasticsearch/elasticsearch:7.10.0
      container_name: es02
      environment:
        - node.name=es02
        - cluster.name=es-docker-cluster
        - discovery.seed_hosts=es01,es03
        - cluster.initial_master_nodes=es01,es02,es03
        - bootstrap.memory_lock=true
        - &quot;ES_JAVA_OPTS=-Xms512m -Xmx512m&quot;
        - xpack.security.http.ssl.key=$CERTS_DIR/es02/es02.key
        - xpack.security.http.ssl.certificate_authorities=$CERTS_DIR/ca/ca.crt
        - xpack.security.http.ssl.certificate=$CERTS_DIR/es02/es02.crt
        - xpack.security.transport.ssl.enabled=true
        - xpack.security.transport.ssl.verification_mode=certificate 
        - xpack.security.transport.ssl.certificate_authorities=$CERTS_DIR/ca/ca.crt
        - xpack.security.transport.ssl.certificate=$CERTS_DIR/es02/es02.crt
        - xpack.security.transport.ssl.key=$CERTS_DIR/es02/es02.key
      ulimits:
        memlock:
          soft: -1
          hard: -1
      volumes:
        - data02:/usr/share/elasticsearch/data
        - 'certs:$CERTS_DIR'
      networks:
        - elastic
    
    es03:
      image: docker.elastic.co/elasticsearch/elasticsearch:7.10.0
      container_name: es03
      environment:
        - node.name=es03
        - cluster.name=es-docker-cluster
        - discovery.seed_hosts=es01,es02
        - cluster.initial_master_nodes=es01,es02,es03
        - bootstrap.memory_lock=true
        - &quot;ES_JAVA_OPTS=-Xms512m -Xmx512m&quot;
        - xpack.security.http.ssl.key=$CERTS_DIR/es03/es03.key
        - xpack.security.http.ssl.certificate_authorities=$CERTS_DIR/ca/ca.crt
        - xpack.security.http.ssl.certificate=$CERTS_DIR/es03/es03.crt
        - xpack.security.transport.ssl.enabled=true
        - xpack.security.transport.ssl.verification_mode=certificate 
        - xpack.security.transport.ssl.certificate_authorities=$CERTS_DIR/ca/ca.crt
        - xpack.security.transport.ssl.certificate=$CERTS_DIR/es03/es03.crt
        - xpack.security.transport.ssl.key=$CERTS_DIR/es03/es03.key
      ulimits:
        memlock:
          soft: -1
          hard: -1
      volumes:
        - data03:/usr/share/elasticsearch/data
        - 'certs:$CERTS_DIR'
      networks:
        - elastic
  
    wait_until_ready:
      image: docker.elastic.co/elasticsearch/elasticsearch:7.10.0
      command: /usr/bin/true
      depends_on: {&quot;es01&quot;: {&quot;condition&quot;: &quot;service_healthy&quot;}}
  
  volumes:
    data01:
    data02:
    data03:
    certs:
  
  networks:
    elastic:
      driver: bridge
  </code></pre>
  <p>docker-compose.production.yml:</p>
  <pre class="lang-yaml prettyprint-override"><code>x-volume: &amp;volume
    driver: azure_file
    driver_opts:
      share_name: acishare
      storage_account_name: &lt;My Storage Account Name&gt;
  
  volumes:
    data01:
      &lt;&lt;: *volume
    data02:
      &lt;&lt;: *volume
    data03:
      &lt;&lt;: *volume
    certs:
      &lt;&lt;: *volume
  </code></pre>
  <p>.env</p>
  <pre><code>COMPOSE_PROJECT_NAME=es
  CERTS_DIR=/usr/share/elasticsearch/config/certificates 
  ELASTIC_PASSWORD=&lt;Default Password&gt;
  </code></pre>
  <p>I've also tried using the <a href="https://docs.docker.com/compose/environment-variables/#the-env-file" rel="nofollow noreferrer">env_file</a> property, but <code>docker compose</code> seems to ignore it.</p>