如何在构建阶段向 Neo4j Docker 容器添加插件,而不是在容器 运行 中下载插件?

How to add plugins to Neo4j Docker Container at build phase instead of dowloading plugins at container run?

我需要我的 neo4j 服务使用几个插件。我的 Neo4j Docker 构建文件是:

FROM neo4j:3.5.14
ENV NEO4J_AUTH='neo4j/password'
ENV NEO4J_ACCEPT_LICENSE_AGREEMENT='yes'
ENV NEO4JLABS_PLUGINS='["apoc", "graph-algorithms"]'
RUN echo "dbms.security.procedures.unrestricted=algo.*" >> ./conf/neo4j.conf

部分ENV NEO4JLABS_PLUGINS='["apoc", "graph-algorithms"]'

将在容器 运行 上下载列出的插件并安装它们。

但是,我必须 运行 在受限环境中使用此容器,而且我无法访问互联网。 我无法在容器 运行.

上下载插件

**我能做些什么来在构建阶段本身添加这些插件,以便它们与图像一起准备好? **

您可以尝试在 non-restricted 环境中构建和部署您的 docker,安装所有内容,然后:

docker commit your-docker your-new-image-with-all-installed
docker save your-new-image-with-all-installed > your-image.tar

之后,您可以将此映像带到您的受限(无互联网)环境并使用以下方式进行部署:

docker load < your-image.tar
docker run ...