title: How can I add a file to a volume in a Docker image, using values from the docker-compose.yml?
body: <p>I have this .env file:</p>
  
  <pre><code>admin=admin
  password=adminsPassword
  stackName=integration-demo
  </code></pre>
  
  <p>the values of which are used in the docker-compose.yml file, like this:</p>
  
  <pre><code>    myService:
        build: 
          context: .
          dockerfile: myService.Dockerfile
          args:
            - instance=${stackName}.local
            - admin=${admin}
            - password=${password}
          volumes:
             - ./config:/config
  
  </code></pre>
  
  <p>I want to add them to the Docker compose file, like this:</p>
  
  <pre><code>FROM openjdk:8-jdk-alpine
  
  ARG docker_properties_file=Username=$admin\nPassword=$password\nHost=$instance
  
  RUN $docker_proprties_file &gt;&gt; config/gradle-docker.properties
  
  </code></pre>
  
  <p>so that I have a gradle-docker.properties file that looks like:</p>
  
  <pre><code>username=admin
  password=adminsPassword
  host=integration.demo.local
  </code></pre>
  
  <p>in the /config directory.</p>
  
  <p>However, no gradle-docker.properties file is getting written.</p>
  
  <p>How can I use the variable in a docker-compose.yml file to add data to a volume?</p>