cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Creating a docker image having neo4j and a c# microservice together

Hi,
I am using Neo4j 4.3.4 Community edition. And I have to use neo4j admin related operations.
In order to completely use the feature, there are couple of issues like

  1. executing the neo4j commands in neo4j bash
  2. restarting the neo4j database after the operation.
    To perform these operations, having neo4j and c# microservice as separate docker containers was not a solution.
    Hence I have started creating a docker image which shall include neo4j and my c# microservice together in an image as shown in
    3X_4_a_4a9c12cd8eab35aa4db8e71f38e2a9129e202dba.png

To do this, I have started following the link - Running neo4j as part of a docker multi-stage build - #3 by molinelli.evan
Though this helped a lot, I am still not able to see both neo4j and the microservice up and running together.

I read that the neo4j code has to be built locally by cloning - GitHub - neo4j/docker-neo4j: Docker Images for the Neo4j Graph Database.

Please clarify which is the correct solution to my problem.
As I am new to both docker and neo4j, any suggestions/inputs will be very helpful.

Thank you

2 REPLIES 2

You should avoid putting both processes into one docker container. This is likely causing an issue for you.

Containers typically run one process; the way you layered your Docker container very much matters here, but likely what's happening is that the neo4j process is running and the C# Microservice isn't, so that's probably the blocker (dependent on your Dockerfile)

The better way to do this is to create your microservice in one container, use the regular neo4j container in the other, and then tell your microservice the hostname of the neo4j container. People will sometimes use things like docker-compose and kubernetes to "orchestrate" multiple containers to run together like this.

Check out this article on container processes for more information about docker and why I'm recommending this: Containers: one single process, or multiple processes?

Thank you David for the response.
The issue in having the two processes running in separate containers is that, I have to use neo4j admin import functionality. And to do that, i have to execute neo4j admin command from within the neo4j container.
To initiate that, I had found a way too to start a script which monitor for another file and as soon as that file is received, import functionality shall be executed.
however, after the import command, the database has to be restarted. To do this, again i had to find some way.
So, started working on having two processes inside a container as they both have access to each other and by that, the microservice can stop the database, execute import command, restart the database easily.

I understand your point about not having multiple process inside a single container.
In this situation, this approach seemed to be a good solution.