cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How to install plugins in neo4j docker at image build phase? I have to run it in a restricted env

I need to install plugins in my neo4j container, and this is my build file:

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 ENV NEO4JLABS_PLUGINS='["apoc", "graph-algorithms"]' part should download and install the plugins at container run.

However, I have to run this container in a restricted environment, with no internet access. So, I cannot rely on the download and install on container run.
How can i download and install the plugins at the docker image build phase, so that the plugins come ready with image and no further download is required ?

1 ACCEPTED SOLUTION

You will need to identify the jar versions you need, and download them in advance. Also, this means you won't use NEO4JLABS_PLUGIN (it is dynamic and pulls from the internet).

Identify the versions you need, download and put them in the container's plugin directory.

For example the last time I did it that way I used these jars (these may NOT be the versions you need)
https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/3.5.0.9/apoc-3.5.0.9-all.ja...
https://github.com/neo4j/graph-data-science/releases/download/1.1.0/neo4j-graph-data-science-1.1.0-s...

I prefer using NEO4JLABS_PLUGIN but sometimes the json NEO4JLABS_PLUGIN uses isn't setup with the latest release jar information, yet... So I retain the wget's in my script for those times when I switch back to manually fetching the jars.

I map the plugins directory in the container to a host folder and put the jars in there...
e.g.
--volume ${NEO_GRAPH_DIR}/plugins:/plugins

View solution in original post

1 REPLY 1

You will need to identify the jar versions you need, and download them in advance. Also, this means you won't use NEO4JLABS_PLUGIN (it is dynamic and pulls from the internet).

Identify the versions you need, download and put them in the container's plugin directory.

For example the last time I did it that way I used these jars (these may NOT be the versions you need)
https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/3.5.0.9/apoc-3.5.0.9-all.ja...
https://github.com/neo4j/graph-data-science/releases/download/1.1.0/neo4j-graph-data-science-1.1.0-s...

I prefer using NEO4JLABS_PLUGIN but sometimes the json NEO4JLABS_PLUGIN uses isn't setup with the latest release jar information, yet... So I retain the wget's in my script for those times when I switch back to manually fetching the jars.

I map the plugins directory in the container to a host folder and put the jars in there...
e.g.
--volume ${NEO_GRAPH_DIR}/plugins:/plugins