title: EC2 with Docker and EBS volume, mount EBS volume inside container during init
body: <p>I actually trying to achieve something with Docker but I'm stuck, there is my problem.</p>
  
  <p>I have my container hosted on EC2 with my web app inside it. My webapp use as database a JCR repository which is basically a file stored where you want. So each time my web app start, if the repository doesn't exist, it create it otherwise it use the existing.</p>
  
  <p>My current docker file look like this <a href="https://gist.github.com/agonist/7cab7358379e9dd6e812" rel="noreferrer">https://gist.github.com/agonist/7cab7358379e9dd6e812</a> ./chameleon.sh start just start my webapp. In this app, I configured where the repository file is located.</p>
  
  <p>Now I creted a EBS volume attached and mounted in my EC2 instance. This volume will be dedicated to store the repository. So basicaly in my app I configure my repository path to <code>/mnt/repository/</code> where repository is the directory which will contain my repository file created by my web app.
  But I don't know how I can mount this volume to my container before the  <code>./chameleon.sh start</code> in the Dockefile. As I see during my research </p>
  
  <pre><code>docker run -v /mnt/repository:/mnt/repository aws_beanstalk/current-app
  </code></pre>
  
  <p>is not executable from the Dockefile.</p>
  
  <p>I also found stuff about data only container which share a volume with another container, but still the same probleme if I have to run </p>
  
  <pre><code>sudo docker run -d --volumes-from dbdata
  </code></pre>
  
  <p>after my container started</p>