title: Docker container save logs on the host directory
body: <p>I have a question similar to <a href="https://stackoverflow.com/questions/41358285/log-doesnt-save-to-file-in-docker-environment">this one</a>. When run my <code>docker-compose.yml</code> file, I automatically create a docker image and as specified in my <code>dockerfile</code>, I run certain apps. These apps produce some logs, but these logs are written <em>inside</em> the docker container, in <code>/home/logs/</code> folder.</p>
  <p>How can I indicate that these logs be writted <em>outside</em> the container, on my <code>/path/on/host</code> address? Simply because if the container was failed, I need to see the logs and not lose them!</p>
  <p>This is my <code>docker-compose.yml</code>:</p>
  <pre><code>version: '3'
  services:
    myapp:
      build: .
      image: myapp
      ports:
        - &quot;9001:9001&quot;
  </code></pre>
  <p>and here is my <code>dockerfile</code>:</p>
  <pre><code>FROM java:latest
  COPY myapp-1.0.jar /home
  CMD java -jar /home/myapp-1.0.jar
  </code></pre>
  <p>And I simply run it on production machine with <code>docker-compose up -d</code>.</p>
  <p>(BTW, I'm new to dockers. Are all of my steps correct? Am I missing anything?! I see all is fine and myapp is running though!)</p>