neo4j/docker-neo4j

/var/lib/neo4j/bin/neo4j: line 197: /var/lib/neo4j/conf/neo4j.conf: Permission denied

Closed this issue · 1 comments

I always get this error when I tried to launch a neo4j container.

At first I ran:
docker run -it \

--publish=7474:7474 --publish=7687:7687
--volume=/var/lib/neo4j/data:/data
--volume=/var/lib/neo4j/config:/config
neo4j:latest

I got this error:
Warning: Folder mounted to "/data" is not writable from inside container. Changing folder owner to neo4j.
/var/lib/neo4j/bin/neo4j: line 197: /var/lib/neo4j/conf/neo4j.conf: Permission denied

I thought it may be caused by the permission, then I tried to switch the user by --user="$(id -u):$(id -g)", same error just appears.

Then I just ran docker run -it neo4j, it doesn't work either and I get the same error.

Could anyone tell me what should I do? It seems that this isn't caused by the permission of volume.'

Thank you!

OK, first thing.
To mount configuration files, you need to mount the volume to /conf not /config, so with your original docker run it's not going to use your configuration file. Also under neo4j home folder it's conf not config, so when you run --volume=/var/lib/neo4j/config:/config docker will helpfully create the (empty) folder /var/lib/neo4j/config on your host system as root. But because that folder is owned by root, it won't be writable from inside the container, and it'll fail.
Basically you'll just need to do this instead:

docker run -it \
    --publish=7474:7474 --publish=7687:7687
    --volume=/var/lib/neo4j/data:/data
    --volume=/var/lib/neo4j/conf:/conf
    neo4j:latest

Second thing.
This doesn't explain why docker run -it neo4j:latest doesn't work, that's a genuine problem. There's already a github issue for this:
#223
but it doesn't happen consistently and I've so far not been able to reproduce the problem. It seems to be something like the neo4j image getting corrupted in the docker cache. Some people have reported what fixed it for them in the issue, so maybe you will have some luck there.
I would recommend clearing your docker cache and docker images and making sure you are running the latest docker version and then restart the docker daemon.

I'm going close this issue because it's a duplicate of issue #223 but feel free to comment over there.