| 
 | 1 | +:description: How to load plugins when using Neo4j in Docker.  | 
 | 2 | +[[docker-plugins]]  | 
 | 3 | += Plugins  | 
 | 4 | + | 
 | 5 | + | 
 | 6 | +This page describes how to install plugins into a Neo4j instance running inside a Docker container.  | 
 | 7 | +For instructions about plugins in general see xref:configuration/plugins.adoc[Configuration -> Plugins].  | 
 | 8 | + | 
 | 9 | + | 
 | 10 | + | 
 | 11 | +[[docker-plugins-procedures]]  | 
 | 12 | +== Installing plugins  | 
 | 13 | + | 
 | 14 | +To install plugins, including  link:{neo4j-docs-base-uri}/java-reference/{page-version}/extending-neo4j/procedures#extending-neo4j-procedures[user-defined procedures], mount the folder or volume containing the plugin JARs to `/plugins`, for example:  | 
 | 15 | + | 
 | 16 | +[source, shell, subs="attributes"]  | 
 | 17 | +----  | 
 | 18 | +docker run \  | 
 | 19 | +   --publish=7474:7474 --publish=7687:7687 \  | 
 | 20 | +   --volume=$HOME/neo4j/plugins:/plugins \  | 
 | 21 | +   neo4j:{neo4j-version-exact}  | 
 | 22 | +----  | 
 | 23 | + | 
 | 24 | +Neo4j automatically loads any plugins found in the `/plugins` folder on startup.  | 
 | 25 | + | 
 | 26 | + | 
 | 27 | +[[docker-plugins-neo4jplugins]]  | 
 | 28 | +== `NEO4J_PLUGINS` utility  | 
 | 29 | + | 
 | 30 | +The Neo4j Docker image includes a startup script that can automatically download and configure certain Neo4j plugins at runtime.  | 
 | 31 | + | 
 | 32 | +[NOTE]  | 
 | 33 | +====  | 
 | 34 | +This feature is intended to facilitate the use of the Neo4j plugins in development environments, but it is not recommended for production environments.  | 
 | 35 | +
  | 
 | 36 | +To use plugins in production with Neo4j Docker containers, see xref:docker/plugins.adoc#docker-plugins-procedures[Install user-defined procedures].  | 
 | 37 | +====  | 
 | 38 | + | 
 | 39 | +The `NEO4J_PLUGINS` environment variable can be used to specify the plugins to install using this method.  | 
 | 40 | +This should be set to a JSON-formatted list of the xref:configuration/plugins.adoc[supported plugins].  | 
 | 41 | + | 
 | 42 | +[NOTE]  | 
 | 43 | +====  | 
 | 44 | +Running Bloom in a Docker container requires Neo4j Docker image 4.2.3-enterprise or later.  | 
 | 45 | +====  | 
 | 46 | + | 
 | 47 | +If invalid `NEO4J_PLUGINS` values are passed, Neo4j returns a notification that the plugin is not known.  | 
 | 48 | +For example, `--env NEO4J_PLUGINS='["gds"]'` returns the following notification:  | 
 | 49 | + | 
 | 50 | +.Example output  | 
 | 51 | +[source, shell, role="noheader"]  | 
 | 52 | +----  | 
 | 53 | +"gds" is not a known Neo4j plugin. Options are:  | 
 | 54 | +apoc  | 
 | 55 | +apoc-extended  | 
 | 56 | +bloom  | 
 | 57 | +graph-data-science  | 
 | 58 | +graphql  | 
 | 59 | +n10s  | 
 | 60 | +----  | 
 | 61 | + | 
 | 62 | +.Install the APOC Core plugin (`apoc`)  | 
 | 63 | +====  | 
 | 64 | +You can use the Docker argument `--env NEO4J_PLUGINS='["apoc"]'` and run the following command:  | 
 | 65 | +
  | 
 | 66 | +[source, shell, subs="attributes"]  | 
 | 67 | +----  | 
 | 68 | +docker run -it --rm \  | 
 | 69 | +  --publish=7474:7474 --publish=7687:7687 \  | 
 | 70 | +  --env NEO4J_AUTH=none \  | 
 | 71 | +  --env NEO4J_PLUGINS='["apoc"]' \  | 
 | 72 | +  neo4j:{neo4j-version-exact}  | 
 | 73 | +----  | 
 | 74 | +====  | 
 | 75 | + | 
 | 76 | +.Install the APOC Core plugin (`apoc`) and the Graph Data Science plugin (`graph-data-science`)  | 
 | 77 | +====  | 
 | 78 | +You can use the Docker argument `--env NEO4J_PLUGINS='["apoc", "graph-data-science"]'` and run the following command:  | 
 | 79 | +
  | 
 | 80 | +[source, shell, subs="attributes"]  | 
 | 81 | +----  | 
 | 82 | +docker run -it --rm \  | 
 | 83 | +  --publish=7474:7474 --publish=7687:7687 \  | 
 | 84 | +  --env NEO4J_AUTH=none \  | 
 | 85 | +  --env NEO4J_PLUGINS='["apoc", "graph-data-science"]' \  | 
 | 86 | +  neo4j:{neo4j-version-exact}  | 
 | 87 | +----  | 
 | 88 | +====  | 
 | 89 | + | 
 | 90 | +[[docker-plugins-caching]]  | 
 | 91 | +== Storing downloaded plugins  | 
 | 92 | + | 
 | 93 | +In situations where bandwidth is limited, or Neo4j is stopped and started frequently, it may be desirable to download plugins once and re-use them rather than downloading them each time.  | 
 | 94 | + | 
 | 95 | +By using the `NEO4J_PLUGINS` utility in combination with mounting storage to `/plugins`, the plugin jars are downloaded into the `/plugins` folder.  | 
 | 96 | +This can then be used again later to supply the same plugins to Neo4j without needing to set `NEO4J_PLUGINS`.  | 
 | 97 | + | 
 | 98 | +.Example of automatically downloading and re-using plugins with docker.  | 
 | 99 | +====  | 
 | 100 | +.Get the APOC plugin and save it into `$HOME/neo4j/plugins`  | 
 | 101 | +[source, shell, subs="attributes+,+macros"]  | 
 | 102 | +----  | 
 | 103 | +docker run -it --rm \  | 
 | 104 | +  --publish=7474:7474 --publish=7687:7687 \  | 
 | 105 | +  --env NEO4J_AUTH=none \  | 
 | 106 | +  --env NEO4J_PLUGINS='["apoc"]' \  | 
 | 107 | +   --volume=$HOME/neo4j/plugins:/plugins \ # <1>  | 
 | 108 | +  neo4j:{neo4j-version-exact}  | 
 | 109 | +----  | 
 | 110 | +<1> Mounts host folder `$HOME/neo4j/plugins` to `/plugins`.  | 
 | 111 | +
  | 
 | 112 | +.Verify the `apoc` plugin is downloaded.  | 
 | 113 | +[source, shell]  | 
 | 114 | +----  | 
 | 115 | +docker kill <containerID/name>  | 
 | 116 | +ls $HOME/neo4j/plugins  | 
 | 117 | +  apoc.jar  | 
 | 118 | +----  | 
 | 119 | +
  | 
 | 120 | +.Start a new container and verify `apoc` is installed.  | 
 | 121 | +[source, shell, subs="attributes"]  | 
 | 122 | +----  | 
 | 123 | +docker run -it --rm \  | 
 | 124 | +  --publish=7474:7474 --publish=7687:7687 \  | 
 | 125 | +  --env NEO4J_AUTH=none \  | 
 | 126 | +   --volume=$HOME/neo4j/plugins:/plugins \  | 
 | 127 | +  neo4j:{neo4j-version-exact}  | 
 | 128 | +
  | 
 | 129 | +cypher-shell "RETURN apoc.version();"  | 
 | 130 | +----  | 
 | 131 | +====  | 
 | 132 | + | 
 | 133 | +[[docker-plugins-licenses]]  | 
 | 134 | +== Installing plugin licenses  | 
 | 135 | + | 
 | 136 | +If a plugin requires a license, the license file can be supplied to the container by mounting the folder or volume containing license file(s) to `/licenses`.  | 
 | 137 | + | 
 | 138 | +[NOTE]  | 
 | 139 | +====  | 
 | 140 | +To check if the plugin requires a license, refer to the xref:configuration/plugins.adoc[general plugin documentation].  | 
 | 141 | +====  | 
 | 142 | + | 
 | 143 | +.Installing plugins and licenses by mounting folders to the container  | 
 | 144 | +====  | 
 | 145 | +[source, shell, subs="attributes+,+macros"]  | 
 | 146 | +----  | 
 | 147 | +docker run \  | 
 | 148 | +   --publish=7474:7474 --publish=7687:7687 \  | 
 | 149 | +   --volume=$HOME/neo4j/plugins:/plugins \   # <1>  | 
 | 150 | +   --volume=$HOME/neo4j/licenses:/licenses \ # <2>  | 
 | 151 | +   neo4j:{neo4j-version-exact}  | 
 | 152 | +----  | 
 | 153 | +<1> folder containing plugin jars.  | 
 | 154 | +<2> folder containing license files.  | 
 | 155 | +====  | 
 | 156 | + | 
 | 157 | +The licenses must also be provided if using the `NEO4J_PLUGINS` utility to install the plugins.  | 
 | 158 | + | 
 | 159 | +.Installing plugins and licenses by mounting folders to the container using `NEO4J_PLUGINS` utility  | 
 | 160 | +====  | 
 | 161 | +[source, shell, subs="attributes+,+macros"]  | 
 | 162 | +----  | 
 | 163 | +docker run \  | 
 | 164 | +   --publish=7474:7474 --publish=7687:7687 \  | 
 | 165 | +   --env NEO4J_PLUGINS='["bloom"]' \  | 
 | 166 | +   --volume=$HOME/neo4j/licenses:/licenses \ # <1>  | 
 | 167 | +   neo4j:{neo4j-version-exact}  | 
 | 168 | +----  | 
 | 169 | +<1> A folder containing license files.  | 
 | 170 | +====  | 
0 commit comments