【发布时间】:2019-12-17 03:34:40
【问题描述】:
我有一个工作 dockerfile 来设置 elasticsearch 如下:
FROM elasticsearch:6.5.4
WORKDIR /app
ADD . /app
ADD analysis /usr/share/elasticsearch/config/analysis
COPY test.sh .
EXPOSE 9200
EXPOSE 9300
我当前的文件目录如下:
C:.
| Dockerfile
| test.sh
|
+---analysis
| wn_s.pl
|
\---poppler
+---bin
| AUTHORS
| BINARIES
| COPYING
| COPYING3
| freetype6.dll
| jpeg62.dll
我想将 poppler 中的 bin 文件夹作为环境变量 PATH 用于 elasticsearch。为此,我在 dockerfile 中附加了
FROM elasticsearch:6.5.4
WORKDIR /app
ADD . /app
ADD analysis /usr/share/elasticsearch/config/analysis
COPY test.sh .
EXPOSE 9200
EXPOSE 9300
ENV PATH=/app/es/poppler/bin
因此,创建了映像,但是当使用该映像创建容器时,它在启动时退出,并在 docker 日志中出现以下错误:
/usr/local/bin/docker-entrypoint.sh: line 62: env: command not found
/usr/local/bin/docker-entrypoint.sh: line 93: id: command not found
/usr/local/bin/docker-entrypoint.sh: line 8: id: command not found
/usr/share/elasticsearch/bin/elasticsearch: line 17: dirname: command not found
/usr/share/elasticsearch/bin/elasticsearch: line 17: /elasticsearch-env: No such file or directory
/usr/share/elasticsearch/bin/elasticsearch: line 20: : command not found
/usr/share/elasticsearch/bin/elasticsearch: line 25: grep: command not found
/usr/share/elasticsearch/bin/elasticsearch: line 27: exec: : not found
我已经成功地在以前的项目中以类似的方式添加环境变量,但是,尽管在 stackoverflow 上进行了搜索,但我仍然无法找出问题所在。
【问题讨论】:
-
grep: command not foundgrep 也是来自环境变量? -
这是因为您将 PATH 环境变量替换为您的值,而不是将其添加到 PATH 变量中。
标签: docker elasticsearch dockerfile