Как создать образ докера с предварительно загруженным ядром - PullRequest
0 голосов
/ 07 февраля 2019

Я пытаюсь создать Dockerfile и Docker-compose, которые будут автоматически запускать рабочий экземпляр Solr с предварительно загруженным ядром.

Это то, что у меня есть, но я получаю ошибки в solrпри запуске.

Dockerfile

from solr:latest

COPY mycore /opt/solr/server/solr/mycores/mycore

docker-compose

version: '2'
services:
  solr:
    build: .
    image: my-solr-image
    ports:
     - "8983:8983"
    environment:
      - SOLR_HEAP=2g
    entrypoint:
      - docker-entrypoint.sh
      - solr-precreate
      - mycore

Вот ошибка, с которой я столкнулся.

Показанокогда я загружаю панель управления

mycore: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: /opt/solr/server/solr/mycores/mycore/data/index/write.lock

В консоли сразу после запуска сервера

sf_solr | 2019-02-08 01:01:22.741 INFO  (main) [   ] o.e.j.s.Server Started @2779ms
sf_solr | 2019-02-08 01:01:22.852 INFO  (coreLoadExecutor-9-thread-1) [   x:mycore] o.a.s.c.SolrConfig Using Lucene MatchVersion: 7.6.0
sf_solr | 2019-02-08 01:01:23.142 INFO  (coreLoadExecutor-9-thread-1) [   x:mycore] o.a.s.s.IndexSchema [mycore] Schema name=default-config
sf_solr | 2019-02-08 01:01:23.774 INFO  (coreLoadExecutor-9-thread-1) [   x:mycore] o.a.s.s.IndexSchema Loaded schema default-config/1.6 with uniqueid field id
sf_solr | 2019-02-08 01:01:23.802 INFO  (coreLoadExecutor-9-thread-1) [   x:mycore] o.a.s.c.CoreContainer Creating SolrCore 'mycore' using configuration from instancedir /opt/solr/server/solr/mycores/mycore, trusted=true
sf_solr | 2019-02-08 01:01:23.824 INFO  (coreLoadExecutor-9-thread-1) [   x:mycore] o.a.s.m.r.SolrJmxReporter JMX monitoring for 'solr.core.mycore' (registry 'solr.core.mycore') enabled at server: com.sun.jmx.mbeanserver.JmxMBeanServer@5562c41e
sf_solr | 2019-02-08 01:01:23.836 INFO  (coreLoadExecutor-9-thread-1) [   x:mycore] o.a.s.c.SolrCore [[mycore] ] Opening new SolrCore at [/opt/solr/server/solr/mycores/mycore], dataDir=[/opt/solr/server/solr/mycores/mycore/data/]
sf_solr | 2019-02-08 01:01:23.857 INFO  (coreLoadExecutor-9-thread-1) [   x:mycore] o.a.s.c.SolrCore [mycore]  CLOSING SolrCore org.apache.solr.core.SolrCore@6b1f208b
sf_solr | 2019-02-08 01:01:23.857 INFO  (coreLoadExecutor-9-thread-1) [   x:mycore] o.a.s.m.SolrMetricManager Closing metric reporters for registry=solr.core.mycore, tag=6b1f208b
sf_solr | 2019-02-08 01:01:23.858 INFO  (coreLoadExecutor-9-thread-1) [   x:mycore] o.a.s.m.r.SolrJmxReporter Closing reporter [org.apache.solr.metrics.reporters.SolrJmxReporter@10f7ad61: rootName = null, domain =
solr.core.mycore, service url = null, agent id = null] for registry solr.core.mycore / com.codahale.metrics.MetricRegistry@14360d1d
sf_solr | 2019-02-08 01:01:23.866 ERROR (coreContainerWorkExecutor-2-thread-1) [   ] o.a.s.c.CoreContainer Error waiting for SolrCore to be loaded on startup
sf_solr | org.apache.solr.common.SolrException: Unable to create core [mycore]
sf_solr |       at org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:1159) ~[solr-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:47:52]
sf_solr |       at org.apache.solr.core.CoreContainer.lambda$load$13(CoreContainer.java:684) ~[solr-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:47:52]
sf_solr |       at com.codahale.metrics.InstrumentedExecutorService$InstrumentedCallable.call(InstrumentedExecutorService.java:197) ~[metrics-core-3.2.6.jar:3.2.6]
sf_solr |       at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
sf_solr |       at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:209) [solr-solrj-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:47:53]
sf_solr |       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
sf_solr |       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
sf_solr |       at java.lang.Thread.run(Thread.java:834) [?:?]
sf_solr | Caused by: org.apache.solr.common.SolrException: /opt/solr/server/solr/mycores/mycore/data/index/write.lock
sf_solr |       at org.apache.solr.core.SolrCore.<init>(SolrCore.java:1014) ~[solr-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:47:52]
sf_solr |       at org.apache.solr.core.SolrCore.<init>(SolrCore.java:869) ~[solr-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:47:52]
sf_solr |       at org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:1138) ~[solr-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:47:52]
sf_solr |       ... 7 more
sf_solr | Caused by: java.nio.file.NoSuchFileException: /opt/solr/server/solr/mycores/mycore/data/index/write.lock
sf_solr |       at sun.nio.fs.UnixException.translateToIOException(UnixException.java:92) ~[?:?]
sf_solr |       at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) ~[?:?]
sf_solr |       at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116) ~[?:?]
sf_solr |       at sun.nio.fs.UnixPath.toRealPath(UnixPath.java:860) ~[?:?]
sf_solr |       at org.apache.lucene.store.NativeFSLockFactory.obtainFSLock(NativeFSLockFactory.java:108) ~[lucene-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:44:20]
sf_solr |       at org.apache.lucene.store.FSLockFactory.obtainLock(FSLockFactory.java:41) ~[lucene-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:44:20]
sf_solr |       at org.apache.lucene.store.BaseDirectory.obtainLock(BaseDirectory.java:45) ~[lucene-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:44:20]
sf_solr |       at org.apache.lucene.store.FilterDirectory.obtainLock(FilterDirectory.java:105) ~[lucene-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:44:20]
sf_solr |       at org.apache.solr.core.SolrCore.isWriterLocked(SolrCore.java:729) ~[solr-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:47:52]
sf_solr |       at org.apache.solr.core.SolrCore.initIndex(SolrCore.java:750) ~[solr-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:47:52]
sf_solr |       at org.apache.solr.core.SolrCore.<init>(SolrCore.java:960) ~[solr-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:47:52]
sf_solr |       at org.apache.solr.core.SolrCore.<init>(SolrCore.java:869) ~[solr-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:47:52]
sf_solr |       at org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:1138) ~[solr-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:47:52]
sf_solr |       ... 7 more
sf_solr |       Suppressed: java.nio.file.AccessDeniedException: /opt/solr/server/solr/mycores/mycore/data/index/write.lock
sf_solr |               at sun.nio.fs.UnixException.translateToIOException(UnixException.java:90) ~[?:?]
sf_solr |               at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) ~[?:?]
sf_solr |               at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116) ~[?:?]
sf_solr |               at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:215) ~[?:?]
sf_solr |               at java.nio.file.Files.newByteChannel(Files.java:370) ~[?:?]
sf_solr |               at java.nio.file.Files.createFile(Files.java:647) ~[?:?]
sf_solr |               at org.apache.lucene.store.NativeFSLockFactory.obtainFSLock(NativeFSLockFactory.java:98) ~[lucene-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:44:20]
sf_solr |               at org.apache.lucene.store.FSLockFactory.obtainLock(FSLockFactory.java:41) ~[lucene-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:44:20]
sf_solr |               at org.apache.lucene.store.BaseDirectory.obtainLock(BaseDirectory.java:45) ~[lucene-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:44:20]
sf_solr |               at org.apache.lucene.store.FilterDirectory.obtainLock(FilterDirectory.java:105) ~[lucene-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:44:20]
sf_solr |               at org.apache.solr.core.SolrCore.isWriterLocked(SolrCore.java:729) ~[solr-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:47:52]
sf_solr |               at org.apache.solr.core.SolrCore.initIndex(SolrCore.java:750) ~[solr-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:47:52]
sf_solr |               at org.apache.solr.core.SolrCore.<init>(SolrCore.java:960) ~[solr-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:47:52]
sf_solr |               at org.apache.solr.core.SolrCore.<init>(SolrCore.java:869) ~[solr-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:47:52]
sf_solr |               at org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:1138) ~[solr-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:47:52]
sf_solr |               at org.apache.solr.core.CoreContainer.lambda$load$13(CoreContainer.java:684) ~[solr-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:47:52]
sf_solr |               at com.codahale.metrics.InstrumentedExecutorService$InstrumentedCallable.call(InstrumentedExecutorService.java:197) ~[metrics-core-3.2.6.jar:3.2.6]
sf_solr |               at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
sf_solr |               at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:209) [solr-solrj-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:47:53]
sf_solr |               at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
sf_solr |               at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
sf_solr |               at java.lang.Thread.run(Thread.java:834) [?:?]
...