Check the status of Neo4J via Docker?

I set up my Neo4J db via Docker and I can access Cypher-Shell fine using

docker exec --interactive --tty <container_id> bin/cypher-shell

However, when I try to check whether Neo4J is running using this command:

docker exec --interactive --tty <container_id> bin/neo4j status

It says Neo4j is not running even though it is.

Is it possible to check the status via Docker somehow?


Did you check with

docker ps --filter status=running

Yes, of course the container is running, this is not the issue.

The issue is to access neo4j command from a running container.

It is possible to check if neo4j is running, I have a script I call wait4bolt_outside (below)
which I use to check if neo4j is online and ready after a bulk load db create.
The next step in the script creates indexes, and other misc cypher (label graph islands),
and those scripts can't run successfully until neo4j is completely online and ready.




if [[ -z ${CONTAINER} ]]
     echo "Usage:"
     echo "  wait4bolt_outside docker_container"
     echo "  e.g. wait4bolt_outside neo_ag"
     exit 1

PORT=$(docker exec -t ${CONTAINER} bash -c 'echo $NEO4J_dbms_connector_bolt_advertised__address'
 |cut -d : -f 2)
echo "neo4j bolt is on port ${PORT}"

if [[ -z ${PORT} ]]
     echo "Is ${CONTAINER} running neo4j?  I don't see it..."
     echo "Usage:"
     echo "  wait4bolt_outside docker_container"
     echo "  e.g. wait4bolt_outside neo_ag"
     exit 1

echo "wait for neo4j bolt to respond at port ${PORT}"

# this returns before server is ready
#    curl -i${PORT} 2>&1 | grep -c -e '200 OK' || break 

# try an actual query as test?
  bash -c "until echo 'match (n) return count(n);' | bin/cypher-shell -a bolt://localhost:${PORT
}; do echo $? ; sleep 1; done"

echo 'neo4j online!'

I am going to guess that neo4j status does not work because inside docker neo4j is run in the docker startup script / instead of as a service?

To take a peek inside the running docker container you can launch shell and then run commands, helpful if developing a command, launching a command through docker exec can be a little tricky (with special characters, and issues with stdin/stdout/stderr) I find it easier to get a command working inside docker at the shell prompt, then attempt to launch it from the host outside the container (separately).

docker exec -it containername bash


docker exec -it <containername> /bin/bash


docker exec -it <containername> /bash