I want my data to be persistent in the Docker container in which I am building a neo4j database. However, the commands I've found don't seem to apply to my situation. In fact, it seems that we should do:
docker run -p 7474:7474 -p 7687:7687 neo4j --volume=$HOME/neo4j/data:/data
But in my case there is no neo4 in $HOME:
bash-5.1$ cd $HOME/
.bash_history .config/ Documents/ .gitkraken/ .gphoto/ .lesshst Music/ Public/ Templates/ .wget-hsts
.cache/ Desktop/ Downloads/ .gnome/ .ipython/ .local/ Pictures/ .ssh/ Videos/
.cert/ .docker/ .gitconfig .gnupg/ .jupyter/ .mozilla/ .pki/ Téléchargements/ .vscode/
So I already have a neo4j image and it works great:
bash-5.1$ docker run -p 7474:7474 -p 7687:7687 neo4j
2022-01-14 11:11:24.351+0000 INFO Starting...
2022-01-14 11:11:25.469+0000 INFO ======== Neo4j 4.3.6 ========
2022-01-14 11:11:26.639+0000 INFO Initializing system graph model for component 'security-users' with version -1 and status UNINITIALIZED
2022-01-14 11:11:26.643+0000 INFO Setting up initial user from defaults: neo4j
2022-01-14 11:11:26.643+0000 INFO Creating new user 'neo4j' (passwordChangeRequired=true, suspended=false)
2022-01-14 11:11:26.652+0000 INFO Setting version for 'security-users' to 3
2022-01-14 11:11:26.654+0000 INFO After initialization of system graph model component 'security-users' have version 3 and status CURRENT
2022-01-14 11:11:26.657+0000 INFO Performing postInitialization step for component 'security-users' with version 3 and status CURRENT
2022-01-14 11:11:26.967+0000 INFO Bolt enabled on 0.0.0.0:7687.
2022-01-14 11:11:27.680+0000 INFO Remote interface available at http://localhost:7474/
2022-01-14 11:11:27.681+0000 INFO Started.
If you run this command, you should get an error on the screen:
This happens because the options
docker run
you have to pass in before the image name ( command documentation ):If you launch it putting the name of the image at the end it will work without problems: