This project provides a Docker-based environment for running an Apache TinkerPop Gremlin Server with a TinkerGraph backend, pre-configured for development and testing. It also includes sample data seeding scripts and instructions for interacting with the graph using the Gremlin Console.
-
Dockerfile.gremlin Builds a custom Gremlin Server image using TinkerGraph as the backend and copies the configuration file.
-
docker-compose.yml Defines the Gremlin Server service, network, and port mappings for easy startup and management.
-
conf/tinkergraph-empty.properties Configuration file for TinkerGraph, specifying ID management and enabling example services.
-
scripts/seed.groovy Groovy script to seed the graph with sample identity and address data. Can be loaded via the Gremlin Console.
docker-compose up --buildThis will build the custom Gremlin Server image and start the server on port 8182.
To gracefully stop the running Gremlin Server container, use:
docker-compose downTo start the server again without rebuilding the image, run:
docker-compose upTo run the Gremlin Server in the background (detached mode), use:
docker-compose up -d
Open a new terminal and run:
docker run -it --rm --network host -v ./scripts:/opt/gremlin-console/scripts tinkerpop/gremlin-console:latestThis command starts the Gremlin Console with your local scripts directory mounted for easy script loading. It will map the scripts folder to the scripts folder in the gremlin-console container, this way, any new script created will be available in the container.
In the Gremlin Console, connect to the running Gremlin Server:
:remote connect tinkerpop.server conf/remote.yaml
:remote consoleIf you do not have a conf/remote.yaml, you can connect directly:
:remote connect tinkerpop.server conf/remote.yamlOr, for a simple connection:
:remote connect tinkerpop.server conf/remote.yamlMake sure your remote.yaml points to localhost:8182.
Once connected, load the seed script:
:load scripts/seed.groovyAfter loading the seed script, you can run the following queries in the Gremlin Console to validate that the graph has been populated:
// List all vertices
g.V().valueMap(true)
// Count all edges
g.E().count()This will populate the graph with sample data.
- The Gremlin Server runs on port
8182by default. - The sample data includes identities and addresses, with relationships between them.
- You can modify
scripts/seed.groovyto customize the initial data. - You can create more
.groovyscripts to load in the gremlin console, just follow step #4 to load the newly created scripts.