Using LOAD CSV to import a local file to Neo4j in a Docker container
Asked Answered
E

3

12

So I've been trying to import an external CSV file into my graphdb. My neo4j is stored in a Docker container. I placed the file in NEO_HOME/import, as implied. I called the LOAD CSV command with "file:///mycsv.csv" as an argument, and got the followng in return

Couldn't load the external resource at: file:/var/lib/neo4j/import/mycsv.csv

Since I'm running the Docker container on a Windows environment, I don't see where the /var directory should be. Even when browsing the container itself via the Docker Quickstart Terminal. I still cannot find /var/lib...

When trying to change the .conf file to a different import directory, it didn't help as well.

Did somebody have this before?

Exine answered 25/4, 2017 at 9:39 Comment(0)
A
14

You have to explicitly mount your import folder when invoking docker:

docker run -e NEO4J_AUTH=none -p 7474:7474 -p 7687:7687 -v $PWD/plugins:/plugins -v $PWD/import:/var/lib/neo4j/import neo4j:3.1.3-enterprise
Allness answered 25/4, 2017 at 9:46 Comment(0)
C
0

When you run this command:

   docker run \
     --name testneo4j \
     -p7474:7474 -p7687:7687 \
     -d \
     -v $HOME/neo4j/data:/data \
     -v $HOME/neo4j/logs:/logs \
     -v $HOME/neo4j/import:/var/lib/neo4j/import \
     -v $HOME/neo4j/plugins:/plugins \
     --env NEO4J_AUTH=neo4j/test \
     neo4j:latest

The physical directory on Windows will be probably located in C:\Users\<your user>\neo4j like this:

  C:\Users\<your user>\neo4j data;C import;C logs;C plugins;C

https://i.sstatic.net/VuW46.png

Cardona answered 13/9, 2021 at 9:29 Comment(0)
S
0

Following Stefan Armbuster answer in windows is:

docker run -e NEO4J_AUTH=none -p 7474:7474 -p 7687:7687 -v %cd%/plugins:/plugins -v %cd%/import:/var/lib/neo4j/import neo4j:5.19.0
Sexennial answered 24/5, 2024 at 17:10 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.