运行mkdir文件夹,添加文件夹/并复制文件夹/在dockerfile中,这些文件不工作

fdbelqdn  于 2021-10-10  发布在  Java
关注(0)|答案(0)|浏览(311)

我一直在尝试在docker中构建服务solr,已经编写了一个dockerfile来构建一个映像,dockerfile中的内容如下。

FROM solr:8.6.3
LABEL maintainer="halloweens"

# create Core

USER root
WORKDIR /opt/solr-8.6.3/server/solr  

# RUN mkdir ik_core  // didn't work, so I annotated

ADD ik_core/ .      // I was trying this way to add this directory into it, COPY as well, didn't work 
WORKDIR ik_core
RUN echo 'name=ik_core' > core.properties

# RUN mkdir data    // didn't work, so I annotated

# setup the ik-analyzer    // this part quite succeeded

WORKDIR /opt/solr-8.6.3/server/solr-webapp/webapp/WEB-INF/lib
ADD ik-analyzer-8.3.0.jar .
ADD solr-core-8.6.3.jar .
ADD solr-dataimporthandler-8.6.3.jar .
ADD solr-dataimporthandler-extras-8.6.3.jar .
ADD solr-solrj-8.6.3.jar .
WORKDIR /opt/solr-8.6.3/server/solr-webapp/webapp/WEB-INF
ADD hotword.dic .
ADD stopword.dic .
ADD IKAnalyzer.cfg.xml .

# add conf

ADD managed-schema /opt/solr-8.6.3/server/solr/ik_core/conf  // oop, it's like doesn't have the targer directory, so, didn't work

USER solr

WORKDIR /opt/solr-8.6.3

主要问题是它无法在其中创建新文件夹,也无法将文件夹移动/复制到其中,以下是构建此映像时的一些消息。

Building solr
Step 1/20 : FROM solr:8.6.3
 ---> 6cd44b0427c6
Step 2/20 : LABEL maintainer="halloweens"
 ---> Using cache
 ---> c00102273187
Step 3/20 : USER root
 ---> Using cache
 ---> bf673ba7db76
Step 4/20 : WORKDIR /opt/solr-8.6.3/server/solr
 ---> Using cache
 ---> 49944dc42904
Step 5/20 : ADD ik_core/ .
 ---> Using cache
 ---> a1242656d9b6
Step 6/20 : WORKDIR ik_core
 ---> Using cache
 ---> 3324f309b66d
Step 7/20 : RUN echo 'name=ik_core' > core.properties
 ---> Using cache
 ---> 93375111a380
Step 8/20 : WORKDIR /opt/solr-8.6.3/server/solr-webapp/webapp/WEB-INF/lib
 ---> Using cache
 ---> 090df62ab5f9
Step 9/20 : ADD ik-analyzer-8.3.0.jar .
 ---> Using cache
 ---> 151144e7e5b2
Step 10/20 : ADD solr-core-8.6.3.jar .
 ---> Using cache
 ---> 5b12febb071c
Step 11/20 : ADD solr-dataimporthandler-8.6.3.jar .
 ---> Using cache
 ---> d738b7026a4e
Step 12/20 : ADD solr-dataimporthandler-extras-8.6.3.jar .
 ---> Using cache
 ---> aa2d0a16524d
Step 13/20 : ADD solr-solrj-8.6.3.jar .
 ---> Using cache
 ---> 10562eab8c4b
Step 14/20 : WORKDIR /opt/solr-8.6.3/server/solr-webapp/webapp/WEB-INF
 ---> Using cache
 ---> ce0c98054b6e
Step 15/20 : ADD hotword.dic .
 ---> Using cache
 ---> de3ad2605a45
Step 16/20 : ADD stopword.dic .
 ---> Using cache
 ---> c25cc36a0513
Step 17/20 : ADD IKAnalyzer.cfg.xml .
 ---> Using cache
 ---> e1c19c123f2c
Step 18/20 : ADD managed-schema /opt/solr-8.6.3/server/solr/ik_core/conf
 ---> Using cache
 ---> f8d6d2dd9ed6
Step 19/20 : USER solr
 ---> Using cache
 ---> 989221e33b98
Step 20/20 : WORKDIR /opt/solr-8.6.3
 ---> Using cache
 ---> 5d6c68254e72
Successfully built 5d6c68254e72
Successfully tagged solr_solr:latest
Creating solr ... done

所有者和组是相同的。

total 18308
-rw-r--r-- 1 root       root           937 Jul 17 13:31 Dockerfile
-rw-r--r-- 1 halloweens halloweens       6 Oct 28  2020 hotword.dic
-rw-r--r-- 1 halloweens halloweens 9686058 Oct 22  2020 ik-analyzer-8.3.0.jar
-rw-r--r-- 1 halloweens halloweens     589 Oct 28  2020 IKAnalyzer.cfg.xml
drwxr-xr-x 4 halloweens halloweens      30 Jul 17 13:18 ik_core
-rw-r--r-- 1 halloweens halloweens   64795 Nov  5  2020 managed-schema
-rw-r--r-- 1 halloweens halloweens 6369473 Oct  3  2020 solr-core-8.6.3.jar
-rw-r--r-- 1 halloweens halloweens  231329 Oct  3  2020 solr-dataimporthandler-8.6.3.jar
-rw-r--r-- 1 halloweens halloweens   41007 Oct  3  2020 solr-dataimporthandler-extras-8.6.3.jar
-rw-r--r-- 1 halloweens halloweens   11858 Jul 17 12:05 solr.in.sh
-rw-r--r-- 1 halloweens halloweens 2311259 Oct  3  2020 solr-solrj-8.6.3.jar
-rw-r--r-- 1 halloweens halloweens       8 Oct 28  2020 stopword.dic

下面是ik_core文件夹中的内容。

total 0
drwxr-xr-x 2 halloweens halloweens 6 Jul 17 13:18 conf
drwxr-xr-x 2 halloweens halloweens 6 Jul 17 13:13 data

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题