Running in a container


Running in a container

A container exposing the HTTP API of cayley is available.

Running with default configuration

Container is configured to serve 30kmoviedata with BoltDB as a backend.

docker run -p 64210:64210 -d

Database will be available at http://localhost:64210.

Custom configuration

To run the container one must first setup a data directory that contains the configuration file and optionally contains persistent files (i.e. a boltdb database file).

mkdir data
cp my_config.cfg data/cayley.cfg
cp my_data.nq data/my_data.nq
# initialize and serve database
docker run -v $PWD/data:/data -p 64210:64210 -d -init -quads /data/my_data.nq
# serve existing database
docker run -v $PWD/data:/data -p 64210:64210 -d


  • Containers are isolated environments, so you need to specify paths inside container itself (not to the host).


So I’m following the instructions but I seem to be failing. This is what I’m doing and getting:

I have my directory /data created in my pwd.

docker pull
docker run -v $PWD/data:/data -p 64210:64210 -d -init

My config looks like this:
“database”: “bolt”,
“db_path”: “/Users/matt/Documents/Cayley/data/sample”,
“read_only”: false

and getting this:

E1118 21:38:59.765749       1 quadstore.go:90] Error: couldn't create Bolt database: open /Users/matt/Documents/Cayley/data/sample: no such file or directory
E1118 21:38:59.765988       1 cayley.go:301] open /Users/matt/Documents/Cayley/data/sample: no such file or directory

Do I need to touch sample? I thought that the init would create sample.


This is the path from host machine. Container is an isolated environment, so you need to specify paths inside container itself. Try changing it to /data/sample.


Thanks works like a charm.


One other quick question, if I don’t specify the -v (volume) command and let it write inside its container, as long as that container is preserved my data is preserved as well. But if I do specify a volume location to write to I can destroy the contain but still retain my data is that correct?


Yes, correct