Getting Root User from Dockerized OrientDB

As me & my wife are bootstrapping our own start-up, there are many things we have to do by our own. One of them is devops, which I’m currently still have many things to learn. A friend of mine introduced me to Docker half a year ago and I find the idea is quite interesting. I decided to give it a try and tried to setup a Dockerized OrientDB on Google Compute Engine (GCE).

I setup a GCE instance using an instruction from Google Documentation on Container. Then I use OrientDB image from Joao P Dubas. I managed to run the container but I didn’t know how to get the OrientDB root password 😕

When you run OrientDB for the first time, it will generate a root user with long & random password in its config file. I need to access the config file inside the container but I didn’t know how.

I started to Google around and found a Stack Overflow post on how to run shell or do SSH into a running container. I found a very interesting post about NOT to do SSH into container but use Docker volume instead. I decided to try to use volume.

So I checked the Dockerfile and it seems that OrientDB runs on folder /opt/downloads/. I just need to make that folder accessible as a Docker volume. To make sure, I also check the log output by doing sudo docker logs orientdb on my GCE instance. The OrientDB config file is located at /opt/downloads/orientdb/config/orientdb-server-config.xml

After removing the old OrientdDB container, I re-run the OrientDB container with command:

sudo docker run -d --name orientdb -p 2424:2424 -p 2480:2480 -v /opt/downloads joaodubas/orientdb:latest

That will make the folder /opt/downloads a Docker volume. Now I just have to run another container which can access the same volume. I ran a simple container with shell:

sudo docker run --volumes-from orientdb -i -t busybox /bin/sh

BOOM! Now I could access /opt/downloads/orientdb/config/, read the server-config.xml file, and search for the users sections:

  <user resources="*" password="3C76542178HG987LIUWLKJJKKJSH983HYT" name="root"/> 
  <user resources="connect,server.listDatabases,server.dblist" password="guest" name="guest"/>

Now I can run OrientDB console on my local machine and access the remote server with user root and password 3C76542178HG987LIUWLKJJKKJSH983HYT.

Good luck!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.