我想创建一个solr的docker镜像,在启动时创建一个核心.因此我使用的是针对solr docker容器描述的docker-entrypoint-initdb.d
extension mechanism.文件说
The third way of creating a core at startup is to use the image
extension mechanism explained in the next section.
但它并没有解释如何实现这一目标.
我正在使用的Dockerfile是:
FROM solr:6.6
USER root
RUN mkdir /A12Core && chown -R solr:solr /A12Core
COPY --chown=solr:solr ./services-core/search/A12Core /A12Core/
COPY --chown=solr:solr ./create-a12core.sh /docker-entrypoint-initdb.d/
USER solr
RUN chmod -R a+X /A12Core
文件夹A12Core包含核心的solr配置文件.创建核心的脚本create-a12core.sh是:
#!/bin/bash
solr-precreate A12Core /A12Core
/ A12Core目录包含以下文件:
./core.properties
./conf
./conf/update-script.js
./conf/mapping-ISOLatin1Accent.txt
./conf/schema.xml
./conf/spellings.txt
./conf/solrconfig.xml
./conf/currency.xml
./conf/mapping-FoldToASCII.txt
./conf/_schema_analysis_stopwords_english.json
./conf/stopwords.txt
./conf/synonyms.txt
./conf/elevate.xml
./conf/lang
./conf/lang/stopwords_en.txt
./conf/lang/stopwords_de.txt
但是,当使用上面的Dockerfile和脚本启动图像构建时,似乎会创建一个无限循环.输出是:
/opt/docker-solr/scripts/solr-foreground: running /docker-entrypoint-initdb.d/create-a12core.sh
Executing /opt/docker-solr/scripts/solr-precreate A12Core /A12Core
/opt/docker-solr/scripts/solr-precreate: running /docker-entrypoint-initdb.d/create-a12core.sh
Executing /opt/docker-solr/scripts/solr-precreate A12Core /A12Core
/opt/docker-solr/scripts/solr-precreate: running /docker-entrypoint-initdb.d/create-a12core.sh
Executing /opt/docker-solr/scripts/solr-precreate A12Core /A12Core
/opt/docker-solr/scripts/solr-precreate: running /docker-entrypoint-initdb.d/create-a12core.sh
...
如何使用docker-entrypoint-initdb.d扩展机制创建核心?
最佳答案
提供要执行的precreate-core文件位置,因此请编辑create-a12core.sh,如下所示
原文链接:https://www.f2er.com/docker/436897.html #!/bin/bash
/opt/docker-solr/scripts/precreate-core A12Core /A12Core
经过测试和工作!!!