Search code examples
dockerneo4jneo4j-plugin

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


I need my neo4j service to use few plugins. My Neo4j Docker build file is :

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

The part ENV NEO4JLABS_PLUGINS='["apoc", "graph-algorithms"]'

will download the listed plugins on container run and install them.

But, i have to run this container in a restricted environment , and i do not have internet access. I cannot download the plugins on container run.

**What can i do to add these plugins at the build phase itself, so that they come ready with the image? **


Solution

  • You can try building and deploying your docker in a non-restricted environment, install everything, and then:

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

    After that, you can take this image to your restricted (without internet) environment and deploy with:

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