Getting Started with Aerospike Enterprise Edition On Docker Desktop
Tags: aerospike, database, datascience, nosql
Published: 2021-04-15 17:41:58

What’s the fastest way to start using [Aerospike Database Enterprise Edition](https://www.aerospike.com/products/database-platform/)? The title gives it away: spin up a [Docker](https://www.docker.com/) container! Let’s get you from zero to running your own Aerospike Enterprise Edition instance in <10 minutes.

## Get a Free Enterprise Edition License

Click the [Try Now](https://www.aerospike.com/lp/try-now/) button in the upper-right corner of [aerospike.com](https://www.aerospike.com/), enter your contact information and select the Enterprise Edition option.
<img align="left" width=115 height=47 src="https://github.com/markprincely/asblog_gs_docker_enterprise-edition/blob/main/try_now.png?raw=true">

## Download the Evaluation License File
Check your email and click to download the evaluation license file. The downloaded file is named *evaluation-features.conf*. This is your license to run a fully loaded single node of Aerospike Enterprise Edition (EE). 
![Welcome to the Aerospike Family](https://github.com/markprincely/asblog_gs_docker_enterprise-edition/blob/main/as_ee_welcome.png?raw=true)

## Create a Volume to Share with the Docker Container
Open your Terminal or Windows Linux Subsystem prompt. Use `mkdir` (or `sudo mkdir`, if necessary)  to create a new directory. I created the directory named EE_eval_file in my home directory. Use `cp` or `sudo cp` to copy the *evaluation-features.conf* into the new directory.

> Note: A best practice is to create `/opt/aerospike/etc`, because this mirrors the standard location for the *evaluation-features.conf* file on an Aerospike server. To create that directory, use the command `sudo mkdir -p /opt/aerospike/etc`. 

## Install Docker Desktop & Share the Evaluation Features Directory 
Download and install [Docker Desktop](https://www.docker.com/products/docker-desktop).

In Docker Desktop, go to Preferences → Resources → File Sharing. Click `+` and browse to the directory you created in the previous step to hold your *evaluation-features.conf* file. (Hold Command + Shift when you click to show hidden directories.) To apply the change, click Apply & Restart. Now your EE container will be able to access your evaluation license.  

![Docker Preferences Showing New Share](https://github.com/markprincely/asblog_gs_docker_enterprise-edition/blob/main/docker_file_share.png?raw=true)

At this point, you can close Docker Desktop. You will do the rest from the command line.

## Pull and Spin Up an Enterprise Edition Container
Pull the EE image from the Docker Hub registry using the following command:
```
docker pull aerospike/aerospike-server-enterprise
```

Aerospike maintains a set of images and Docker does the grunt work of downloading and verifying the EE image. 
![Screencap of Docker Pull EE](https://github.com/markprincely/asblog_gs_docker_enterprise-edition/blob/main/docker_pull_ee.png?raw=true)  

Now, you’re ready to spin up your EE container:
```
docker run -tid --name aerospike -p 3000:3000 -p 3001:3001 -p 3002:3002 -v <DIRECTORY>:/aerospike/etc/ -e "FEATURE_KEY_FILE=/aerospike/etc/evaluation-features.conf" -e "NAMESPACE=aerospike-demo" aerospike/aerospike-server-enterprise
```

Replace the text `<DIRECTORY>` with the absolute path to the directory containing your *evaluation-features.conf* file. If using Windows Linux Subsystem, make sure to use your Windows backslashes and drive designations. 

[Docker Run](https://docs.docker.com/engine/reference/commandline/run/) flags used:
*-t* : Tty, allocates a pseudo-tty
*-i* : Interactive mode, keeps STDIN open even if not attached
*-d*  : Detached mode, start the container in the background; exits when the root process used to run the container exits
*--name* : Name, Gives the container the name aerospike 
*-p* : Ports, maps container Ports 3000, 3001, and 3002 to the host
*-v* : Volume, maps a local directory for use in the container
*-e* : Environment, sets environment variables in the container

Here’s the [repo and README.md for the EE dockerfile](https://github.com/aerospike/aerospike-server-enterprise.docker) so you can tailor EE to better suit your evaluation.

Because of the *-d* option, docker returns the container ID.

![Screencap of Docker Run EE](https://github.com/markprincely/asblog_gs_docker_enterprise-edition/blob/main/docker_run_ee.png?raw=true)

At this point, your EE container should be running. Verify with the command:
```
docker ps
```

![Screencap of Docker PS](https://github.com/markprincely/asblog_gs_docker_enterprise-edition/blob/main/docker_ps.png?raw=true)  

## Okay, I have EE running, now what?
It’s play time! :) Let’s add a record and read it using the aerospike-tools Docker Container. First, grab the image: 
```
docker pull aerospike/aerospike-tools
```

![Screencap of Docker Pull Tools](https://github.com/markprincely/asblog_gs_docker_enterprise-edition/blob/main/docker_pull_tools.png?raw=true)  

Next, spin up a new container running [AQL](https://www.aerospike.com/docs/tools/aql/index.html), the Aerospike command-line data browser:
```
docker run -it aerospike/aerospike-tools aql -h  $(docker inspect -f '{{.NetworkSettings.IPAddress }}' aerospike)
``` 

Since AQL is running in a different container from the instance of EE, the above command uses [docker inspect](https://docs.docker.com/engine/reference/commandline/inspect/) to find the IP address of your EE container, and passes it to AQL using the [-h option](https://www.aerospike.com/docs/tools/aql/aql-help.html).

At this point, you can type interactive commands into AQL in your Terminal or WLS prompt. Insert a record into Aerospike EE using the following [data model](https://www.aerospike.com/docs/architecture/data-model.html):
Namespace – *aerospike-demo* (set in the first docker run command) 
Set name – *foo* 
Bin name – *bar*
Primary key – *123*
String data – *‘w00t!’* 

```
insert into aerospike-demo.foo (PK, bar) values (123, 'w00t!')
```
...and view all data in the namespace:
```
select * from aerospike-demo.foo
```
![Screencap of Insert and Select](https://github.com/markprincely/asblog_gs_docker_enterprise-edition/blob/main/aql_w00t.png?raw=true)  

## Next Steps...
Now that Aerospike Enterprise Edition is running, you can download and install an [Aerospike client](https://www.aerospike.com/download/client/), and then REALLY put your Aerospike EE to work. 

Do you want to learn more about using Aerospike Database? Check out our [Developer Hub](https://www.developer.aerospike.com/). There’s a wealth of resources available there to jump-start your Aerospike education! I’m excited for you. If you have any questions, feel free to post on the [Forums](https://discuss.aerospike.com/).

Enjoy efficient management of data at scale!


Thanks to [Yaoqi](https://unsplash.com/photos/7iatBuqFvY0?utm_source=unsplash&utm_medium=referral&utm_content=creditShareLink) for the match.