Docker is a platform which allows you to create an application which can be run in a loosely isolated enviroment. When combined with EVE-NG, we can quickly create applications inside our lab envrioment. An example of this is, instead of insalling a linux server with apache, you can just deploy a prebuilt docker container with apache already installed and configured. This container can then be connected to a virtual router in your lab.
Prerequisites
This Document assumes you already have a EVE-NG installation up and running.
Installing Docker
The easiest way to get started is using the prebuilt docker package in the official ubuntu repository.
After installing, we will make some modifications to our docker config file. EVE-NG is built on top of Ubuntu 16.04 so it utilizes systemd. The perfered method of managing the docker configuration file is to use the daemon json.
To do this, we need to create a file which overrides the execstart parameters. We must do this because the default execstart statement has a host paramater which will conflict with the options given later in our json file.
Next we will create our json configuration file.
Formatting Mistakes
Pay attention to the format because if you make a formatting mistake, the daemon won’t start.
|
|
After making these changes we will need to reload the daemon config and restart the service.
|
|
We can now verify that the process is running.
|
|
Modifying EVE-NG
EVE-NG has support for Docker built in but it is currently commented out. In order to get things working, we’ll need to modify some files.
Uncomment template
You’ll need to uncomment the following line in the init.php file. This will allow EVE-NG to use the docker template.
vim /opt/unet/html/includes/init.php
Modify CLI.php
Docker nodes can have 1 of 4 different states inside EVE-NG. The states are:
- 0 - Stopped
- 1 - Stopped (Locked)
- 2 - Running
- 3 - Running (Locked)
There is an issue in the current code where after stopping a docker node, the state is locked which prevents it from being started.
The following patch comments out the creating of the lock file when a docker node is started.
|
|
|
|
Adding Docker Images
There is a public registry available that you can use to download existing docker images that others have built.
Custom Docker Images
Another option is to extend existing public iages or building your own from scratch
THe following command will attempt to install the docker image if it is found locally. If the image is not available locally, it will be downloaded from the docker repository online.