'How to modify a file within a docker image?

I am running a neo4j image on a Fedora and I have to change the neo4j.conf configuration file located in <NEO4J_HOME>/conf. But I don't know where the neo4j_home is.

According to this answer from the ... dropdown there should be a Terminal option that allows me to find it. But I can't find this ...

enter image description here

Here is what I have in /etc/:

bash-5.1$ gedit /etc/n
nanorc             ndctl/             netconfig          networks           nfs.conf           nfsmount.conf      nftables/          nsswitch.conf      nsswitch.conf.bak  

I can run my container:

bash-5.1$ docker run \
   --detach \
   --publish=7474:7474 --publish=7687:7687 \
   --volume=$HOME/neo4j/data:/data \
   --volume=$HOME/neo4j/logs:/logs \
   --volume=$HOME/neo4j/conf:/conf \
   neo4j
ccd3b8da2f838770c850017d131c9ed4d3825cdcf7a3aaebf825a611bd58a315

But I when I reach the file system I can't edit the file:

bash-5.1$ docker exec -t -i zoologie /bin/bash
root@15c0a418743c:/var/lib/neo4j# cd /conf/
root@15c0a418743c:/conf# nano neo4j.conf 
bash: nano: command not found
root@15c0a418743c:/conf# vim neo4j.conf 
bash: vim: command not found
root@15c0a418743c:/conf# apk install vim
bash: apk: command not found

And while it seems there is a conf file within the container it doesn't seem there is the same thing in the conf volume I mounted:

bash-5.1$ pwd
/home/ac/neo4j/conf
bash-5.1$ ls
bash-5.1$ 


Solution 1:[1]

When installed on Debian or RPM based distros, the conf folder path is /etc/neo4j/neo4j.conf

Source: https://neo4j.com/docs/operations-manual/current/configuration/file-locations/


https://neo4j.com/docs/operations-manual/current/docker/configuration/ explains how to change the configuration when running Neo4j from a Docker image. In a nutshell:

There are three ways to modify the configuration:

  • Set environment variables.
  • Mount a /conf volume.
  • Build a new image.

Which one to choose depends on how much you need to customize the image.

[…]

2. Mounting the /conf volume

To make arbitrary modifications to the Neo4j configuration, provide the container with a /conf volume.

docker run \
   --detach \
   --publish=7474:7474 --publish=7687:7687 \
   --volume=$HOME/neo4j/data:/data \
   --volume=$HOME/neo4j/logs:/logs \
   --volume=$HOME/neo4j/conf:/conf \
   neo4j:4.4

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1