我想创建一个solr的docker映像,在启动时创建一个core。所以我用
docker-entrypoint-initdb.d
extension mechanism
为solr docker容器描述。文件上说
在启动时创建核心的第三种方法是使用映像
下一节将解释扩展机制。
我使用的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入口点initdb.d