I'm trying to make a docker-compose file that starts a Neo4J database and loads a dump file in for immediate use. I dislike installing database systems locally when they are usually just as easy to toss in a docker file, and then are easier to handle and wipe out when needed. However, I just can't seem to get this working. When running instructions I've found online, the docker container just fails to start, without any sort of error message.
Docker-Compose.yml
version: '3.7'
services:
neo4j:
container_name: 'neo4j'
image: neo4j:latest
environment:
- NEO4J_AUTH=neo4j/password
- EXTENSION_SCRIPT=/neo4j-data/neo4j-init.sh
ports:
- "7474:7474"
- "7687:7687"
volumes:
- ./neo4j-data:/data
neo4j-init.sh:
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# do not run init script at each container strat but only at the first start
if [ ! -f /tmp/neo4j-import-done.flag ]; then
/var/lib/neo4j/bin/neo4j-admin neo4j-admin load --from=/data/data.dump --database=graph.db --force
touch /tmp/neo4j-import-done.flag
else
echo "The import has already been made."
fi
This was built entirely from here, and I've followed those instructions exactly, as far as I can tell.