title: Accessing persistent H2 DB in docker container
body: <p>I'm deploying a springboot application and I want to use a persistent DB. So, in application.properties file, I have</p>
  <pre><code>spring.datasource.url=jdbc:h2:file:/home/ubuntu/db;AUTO_SERVER=TRUE;
  </code></pre>
  <p>Now this works as long as I start this application without using a container. Now, I build a docker image and try to run the application. Dockerfile looks like</p>
  <pre><code>FROM maven:3-jdk-11 AS maven
  ARG BUILD = target/build.jar
  COPY ${BUILD} build.jar
  EXPOSE 8080
  USER spring:spring
  ENTRYPOINT[&quot;java&quot;,&quot;-jar&quot;,&quot;/build.jar&quot;]
  </code></pre>
  <p>Now this doesn't work when I try to start it, because it searches for /home/ubuntu/db inside the container, which does not exist. Is there a way to make the app inside the docker container access the host folder /home/ubuntu/db? Thanks for the response.</p>