neo4j/docker-neo4j

Don't download neo4j plugin on every container start

alexlitvinenko opened this issue · 1 comments

I noticed that when I have slow internet (<100kb/s) it takes me eternity to start neo4j using docker. I found out that it comes from the fact that neo4j downloads plugins from github each time I start/restart neo4j.

The problem is in load_plugin_from_github function - it doesn't cache downloaded file.

Hi @alexlitvinenko
Unfortunately there's nothing I can do about that. It's in Docker's nature to be ephemeral and not persist data between containers. There's no way to cache the plugin files like you requested unless you mount a host folder/volume.

When you use NEO4JLABS_PLUGINS, it downloads the files to the /plugins folder in the container. If you mount a host folder to /plugins the plugin files will get cached for you there. For example:

docker run -it --rm \
--publish=7474:7474 --publish=7687:7687 \
--volume=$HOME/neo4j/data:/data \
--volume=$HOME/neo4j/plugins:/plugins \
-e NEO4JLABS_PLUGINS='["apoc"]' \
neo4j:latest

Next time you run neo4j you can mount the same folder to /plugins and NOT set any NEO4JLABS_PLUGINS and your plugins will still be there and loaded into neo4j.

docker run -it --rm \
--publish=7474:7474 --publish=7687:7687 \
--volume=$HOME/neo4j/data:/data \
-volume=$HOME/neo4j/plugins:/plugins \
neo4j:latest