Importing ArangoDB-Dump into a docker file

I want to build a Docker image based on the official ArangoDB image. In the Dockerfile, I copy and execute the wrapper script. This script downloads and unpacks the Arango dump and imports it using arangorestore --input-directory "dump"

.

The console log shows that the import was successful:

# Connected to ArangoDB 'http+tcp://127.0.0.1:8529'
# Re-creating document collection 'pages'...
# Loading data into document collection 'pages'...
# Re-creating edge collection 'links_bar'...
# Loading data into edge collection 'links_bar'...
Processed 2 collection(s), read 143363388 byte(s) from datafiles, sent 19 batch(es)

      

However, when I launch the container of this image and go to the Arango web interface, it seems that there is no data at all ...

+3


source to share


1 answer


OK, since the ArangoDB data directory that is in var/lib/arangodb3/databases/database-1/

is declared as a Volume in the official Dockerfile, then after every instruction in my Dockerfile this volume will become empty.

The workaround for this problem is to overwrite the docker entry point and initialize the database at runtime (not in assembly), or (which is my favorite), just change the ArangoDB data directory:



mkdir /arango-data
chmod 777 /arango-data
sed -i.bak 's/^\(directory = \).*/\1\/arango-data/' /etc/arangodb3/arangod.conf

      

Anything you copy to / arango -data or import to ArangoDB will not be deleted as it is not declared as volumes.

0


source







All Articles