Running ArangoDB on Mac with Docker
When I work with ArangoDB on my Mac, I usually install ArangoDB via homebrew and do tests on the latest new developments based on the devel-branch, compiling ArangoDB right from source.
To test a feature in a special version I use docker images that need a virtual machine on MacOS. I struggled with Boot2Docker several times and recently tried Docker Machine – with the Web UI Kitematic – currently in beta.
Here’s how to start with ArangoDB and Docker Machine:
First you need to install Docker Machine as described here. In my case, the installation process detects an earlier Boot2Docker Installation and migrates it to a new Docker Machine VM. Nice.
During the installation process you can choose to install the Docker Machine and Kitematic (current 0.8). I installed both to have a try. After installation I chose the fancy UI stuff and opened Kitematic.
Searching for ArangoDB you get the official Docker Hub Image as the first result – and by default, the latest stable release.
Just one click on “create” and your ArangoDB container is up and running!
Voilà, ArangoDB is available (1) – you can use the web-interface from the stated ACCESS URL (2), and access the arangosh console with one click on the EXEC (3) icon and then typing arangosh
in the console.
In the settings of my container I can specify a local folder on my Mac to store my Foxx based JavaScript extensions. That allows me to use my favorite editor (e.g. Sublime Text) to edit my Foxx apps right away.
Caution: There’s an option to change the database directory to a local folder too. But that’s not supported in OS X, so you might not want to make use of that option and stick with the default path (or mount a folder in the virtual machine from command line).
Now change the port to something I can remember…:
Now I want to get productive with ArangoDB, so I want to import some data. Therefore, I go to the DOCKER CLI (Link is also provided in Kitematic on the bottom left) and start inspecting what’s running here…:
docker-machine ls
This command shows my running VM called default
on tcp://192.168.99.100:2376 which I want to use with docker commands.
docker-machine env default
eval $(docker-machine env default)
Now I have my docker commands available and can copy some test data that I can import via arangoimp
to my new database.
docker cp mydata.tar.gz arangodb:/tmp/mydata.tar.gz
Next, I’ll extract the JSON data and import everything in the collection customers
using arangoimp:
arangoimp --file RESULTS_CUSTOMERS.json --type json --collection customers
That’s it.
Kitematic allows me to get started with ArangoDB with really just one click. And changing settings like volumes is easy. Do you really need the UI…? Well, I’ve not decided yet.
Updated on 01/22: db volume could not be mounted to a local Mac folder.
Get the latest tutorials, blog posts and news: