title: Logstash unable to load, file not readable
body: <p>Trying to sync between MongoDB and Elasticsearch with <a href="https://dbschema.com/jdbc-drivers/MongoDbJdbcDriver.zip" rel="nofollow noreferrer">MongoDbJdbcDriver</a> by following this <a href="https://stackoverflow.com/a/58849340/10583765">answer</a>. I use <code>docker-compose</code> for development, and this is how it looks like for <code>logstash</code>:</p>
  <pre class="lang-yaml prettyprint-override"><code>  logstash:
      image: logstash:7.9.1
      container_name: logstash
      volumes:
        - ./logstash/jars/gson-2.8.6.jar:/usr/share/logstash/logstash-core/lib/jars/gson-2.8.6.jar:ro
        - ./logstash/jars/mongojdbc2.3.jar:/usr/share/logstash/logstash-core/lib/jars/mongojdbc2.3.jar:ro
        - ./logstash/jars/mongo-java-driver-3.12.6.jar:/usr/share/logstash/logstash-core/lib/jars/mongo-java-driver-3.12.6.jar:ro
        - ./logstash/config/pipelines.yml:/usr/share/logstash/config/pipelines.yml
        - ./logstash/pipeline/mongo-to-elasticsearch.conf:/usr/share/logstash/pipeline/mongo-to-elasticsearch.conf
      command: logstash
      depends_on:
        - elasticsearch
  </code></pre>
  <p>I run <code>docker-compose up</code> and it gives this error:</p>
  <pre><code>...
  logstash         |   Error: unable to load mongojdbc2.3.jar from :jdbc_driver_library, file not readable (please check user and group permissions for the path)
  logstash         |   Exception: LogStash::PluginLoadingError
  ...
  </code></pre>
  <p>I've checked file permission of <code>mongojdbc2.3.jar</code> on my machine, given read and write for me and docker group. However when I check inside <code>logstash</code> container, owner is not <code>root</code> but <code>logstash</code>:</p>
  <pre><code>// ls -l /usr/share/logstash/logstash-core/lib/jars
  
  ...
  -rw-r--r-- 1 logstash logstash  2315317 Jul 24 15:13 mongo-java-driver-3.12.6.jar
  -rw-r--r-- 1 logstash logstash    83500 Sep  8 01:30 mongojdbc2.3.jar
  -rw-rw-r-- 1 logstash root       107210 Sep  1 23:32 org.eclipse.core.commands-3.6.0.jar
  ...
  </code></pre>
  <p>I tried changing ownership inside container but I couldn't do it since I don't have the <code>sudo</code> permission.</p>
  <p>Please help, how I can I sync between MongoDB and Elasticsearch successfully?</p>
  <hr />
  <p>Stack: MongoDB (v4.4.1), Logstash (v7.9.1), Docker (v19.03.12), Docker-compose (v1.27.3)</p>