Setting up Docker

Docker is a convenient tool for virtualization. Docker containers contain a standardized environment that can be run from any desktop or via the cloud, solving many issues with compatibility across operating systems. By running software via Docker instead of directly on a desktop, it becomes possible to run different versions of dependencies side-by-side without affecting existing installations. As a result, running Neo4j via Docker can be more convenient.

Mac and Windows users need to use Docker Desktop, while Linux users can run Docker containers after installing docker-engine. Please make sure Docker can run on your machine using one of the above links. Mac and Windows users also need to launch Docker Desktop after installation to start using Docker containers.

After installing Docker (Desktop), the Neo4j Docker container can be setup by running the commands below from a terminal. Each time you call the Docker container for Neo4j, a Neo4j Docker image is pulled from DockerHub and used to start a container. You can specify a range of commands to configure the Neo4j Docker image. For an expansive guide, please take a look at the Neo4j Docker how-to.


docker run --rm \
-d \
--publish=7475:7474 --publish=7688:7687 \
--name=neo4j \
--env NEO4J_AUTH=neo4j/test \
neo4j:latest

The –rm flag tells Docker to clean up after exiting, while the -d flag means the Docker can be accessed separately.

Importantly, the –publish flag changes exposed ports, so the Neo4j container can be accessed via navigating to http://localhost:7475/browser/ in a browser and setting the connection to neo4j://localhost:7688 or bolt://localhost:7688. The –name flag sets the container’s name, the –env flag sets the username and password for the Neo4j container and neo4j:latest tells Docker to pull the latest image. To stop the Docker container is then quite straightforward:

docker stop neo4j

To start using the Neo4j Docker container, simply run the first command or a modified version of this command, and then navigate to Neo4j Browser to access the database. By passing these parameters to mako, you can have mako import BIOM files and networks to the database. Keep in mind that by default, the data folder is cleared once the container is shut down, so Docker is not as useful for maintaining a local database.