I'm using docker-compose to create a neo4j service from the official image with the following Dockerfile :
FROM neo4j:3.3.4
ADD zz-docker/neo4j/neo4j-init.sh /scripts/
EXPOSE 7474
EXPOSE 7687
and docker-compose.yml
neo4j:
environment:
- EXTENSION_SCRIPT=/scripts/neo4j-init.sh
build:
context: ../
dockerfile: zz-docker/neo4j/Dockerfile
image: zz-neo4j
container_name: zz-neo4j-01
ports:
- 7474:7474
- 7687:7687
networks:
- zz-net
volumes:
- ../neo4j-data:/data
- ../neo4j-logs:/logs
networks:
zz-net:
driver: bridge
The extension script is being used to pre-load a database dump on container start up, based on the post create-neo4j-database-from-backup-inside-neo4j-docker as follows:
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# do not run init script at each container start but only at the first start
if [ ! -f /var/lib/neo4j/data/neo4j-import-done.flag ]; then
echo "Importing neo4j-init.dump ..."
/var/lib/neo4j/bin/neo4j-admin load --from=/var/lib/neo4j/data/neo4j-init.dump --database=graph.db --force=true
touch /var/lib/neo4j/data/neo4j-import-done.flag
echo "Import complete"
else
echo "There is no neo4j-init.dump file or the neo4j import has already run."
fi
However after the import is complete the container fails to start reporting an error:
/docker-entrypoint.sh: line 218: exec su-exec neo4j: command not found
Without the EXTENSION_SCRIPT defined, the container starts-up without a problem (though the script for import isn't run).
Any suggestions gratefully received!