neo4j / docker-neo4j

Docker Images for the Neo4j Graph Database
Apache License 2.0
333 stars 172 forks source link

neo4j-admin:latest image not compatible with neo4j:5.22.0 image #519

Open mateuszpawlik opened 3 days ago

mateuszpawlik commented 3 days ago

I tried to use the neo4j-admin:latest (at pull time 5.21.2 and couldn't find a newer one) image for a database dump as explained in the docs.

The documentation actually lists neo4j-admin:5.24.0 image, which is not available.

I use neo4j:5.22.0 image for my database, because APOC is not available for a newer version.

My command:

docker run --interactive --tty --rm --volume=neo4j_data:/data --volume=$PWD/neo4j-backups:/backups neo4j/neo4j-admin:latest neo4j-admin database dump neo4j --to-path=/backups

I get the following error:

2024-10-15 09:27:10.749+0000 INFO  [o.n.c.d.DumpCommand] Starting dump of database 'neo4j'
2024-10-15 09:27:10.966+0000 ERROR [o.n.c.d.DumpCommand] Failed to dump database 'neo4j': Failure when checking for recovery state: '%s'.org.neo4j.kernel.impl.transaction.log.entry.UnsupportedLogVersionException: Log file contains entries with prefix 18, and the highest supported Kernel Version is KernelVersion{V5_20,version=17}. This indicates that the log files originates from an newer version of neo4j, which we don't support downgrading from.
2024-10-15 09:27:10.966+0000 ERROR [o.n.c.d.DumpCommand] Dump failed for databases: 'neo4j'
Dump failed for databases: 'neo4j'
$ docker version ``` Client: Docker Engine - Community Version: 27.3.1 API version: 1.47 Go version: go1.22.7 Git commit: ce12230 Built: Fri Sep 20 11:41:11 2024 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 27.3.1 API version: 1.47 (minimum version 1.24) Go version: go1.22.7 Git commit: 41ca978 Built: Fri Sep 20 11:41:11 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.7.22 GitCommit: 7f7fdf5fed64eb6a7caf99b3e12efcf9d60e311c runc: Version: 1.1.14 GitCommit: v1.1.14-0-g2c9f560 docker-init: Version: 0.19.0 GitCommit: de40ad0 ```

Operating system: Debian 12

mateuszpawlik commented 3 days ago

I solved it by using the same image I use for the database.

docker run --interactive --tty --rm --volume=neo4j_data:/data --volume=$PWD/neo4j-backups:/backups neo4j:5.22.0 neo4j-admin database dump neo4j --to-path=/backups
mateuszpawlik commented 19 hours ago

Or so I thought that I fixed it. After cleaning Docker environment, the above command stopped working with:

ERROR [o.n.c.d.DumpCommand] Failed to dump database 'neo4j': Unable to dump database: AccessDeniedException: /backups

It took me several hours to figure out why it stopped working.

One difference between neo4j/neo4j-admin and neo4j images is explicit change of ownership of the /backup directory.

https://github.com/neo4j/docker-neo4j/blob/3788f715e4d69f3df21f9c17efa5af29bd57e27d/docker-image-src/5/neo4j-admin/docker-entrypoint.sh#L133-L135

When I executed neo4j-admin from neo4j/neo4j-admin image, although it failed, it silently (or I missed it) changed the ownership of the /backup directory. Then, neo4j-admin from neo4j simply worked. When I tried again in a fresh docker environment, I started getting AccessDeniedException. It does make sense that the neo4j user from docker container cannot write to my host directory with drwxr-xr-x permissions. However, it was difficult to find out.