title: docker copy file from one container to another?
body: <p>Here is what I want to do:</p>
  
  <ol>
  <li>docker-compose build</li>
  <li>docker-compose $COMPOSE_ARGS run --rm task1</li>
  <li>docker-compose $COMPOSE_ARGS run --rm task2</li>
  <li>docker-compose $COMPOSE_ARGS run --rm combine-both-task2</li>
  <li>docker-compose $COMPOSE_ARGS run --rm selenium-test</li>
  </ol>
  
  <p>And a docker-compose.yml that looks like this:</p>
  
  <pre><code>task1:
    build: ./task1
    volumes_from:
      - task1_output
    command: ./task1.sh
  
  task1_output:
    image: alpine:3.3
    volumes:
      - /root/app/dist
    command: /bin/sh
  
  # essentially I want to copy task1 output into task2 because they each use different images and use different tech stacks... 
  task2:
    build: ../task2
    volumes_from:
      - task2_output
      - task1_output:ro
    command: /bin/bash -cx "mkdir -p task1 &amp;&amp; cp -R /root/app/dist/* ."
  </code></pre>
  
  <p>So now all the required files are in task2 container... how would I start up a web server and expose a port with the content in task2?</p>
  
  <p>I am stuck here... how do I access the stuff from task2_output in my combine-tasks/Dockerfile:</p>
  
  <pre><code>combine-both-task2:
    build: ../combine-tasks
    volumes_from:
       - task2_output
  </code></pre>