I started two containers via a bridge as follows:
docker network create -d bridge my-net
docker run --name arangodb -p 8529:8529 -e ARANGO_ROOT_PASSWORD=openSesame --network=my-net -d arangodb/arangodb:3.6.5
docker run --name arangodb-client --network=my-net -it --rm arangodb-client-image
to build arangodb-client-image, I used the following Dockerfile
FROM python:3
ADD init.py /
RUN pip install pyArango
CMD [ "python3", "./init.py" ]
and init.py
from pyArango.connection import *
conn = Connection(arangoURL="http://arangodb:8529", username="root", password="openSesame")
#Creating and Opening Databases
db = conn.createDatabase(name="school")
# Creating Collections Documents
studentsCollection = db.createCollection(name="Students")
students = [('Oscar', 'Wilde', 3.5), ('Thomas', 'Hobbes', 3.2),
('Mark', 'Twain', 3.0), ('Kate', 'Chopin', 3.8), ('Fyodor', 'Dostoevsky', 3.1),
('Jane', 'Austen',3.4), ('Mary', 'Wollstonecraft', 3.7), ('Percy', 'Shelley', 3.5),
('William', 'Faulkner', 3.8), ('Charlotte', 'Bronte', 3.0)]
for (first, last, gpa) in students:
doc = studentsCollection.createDocument()
doc['name'] = "%s %s" % (first, last)
doc['gpa'] = gpa
doc['year'] = 2017
doc._key = ''.join([first, last]).lower()
doc.save()
But when I open http://localhost:8529 in my machine, I can't select school database in the pull-down menu. but if use
docker exec -it arangodb arangosh --server.database school
I can see all the collections in school database.