Guide for NetApp Containerization & External Configuration for Developers


Version: 0.1


All NetApp deployments must have the following 2 files:

  • Dockerfile ( or docker-compose.yml if the NetApp requires more than one container). This file allows for the virtualization and containerization of the NetApp.
  • NetApp configuration file named config.json :All hardcoded parameters in your code (e.g. usernames, passwords, IP, endpoints) must be added to this configuration file and removed from your code. These configuration values must be loaded in the NetApp through this configuration file and must not be directly hardcoded in the code.



0) Install Docker

Install Docker from the official Docker webpage if you don’t have Docker already installed in your system - it is preferable than installing Docker from repositories, that may be outdated-. If you need to use docker-compose (only in the case of requiring a multi-container deployment), also install it from the official webpage.

1) Create the Docker image of your NetApp

Create a requirements.txt file in the root folder of your NetApp project containing the names of the Python dependencies required (e.g. flask, evolved5g, jsonpickle…), filling 1 dependency per line.





Create the Dockerfile for containerizing the NetApp in your project root folder – a file named “Dockerfile” without extension. Find below a Dockerfile template that creates a Docker image for a generic NetApp: it provides an encapsulated Linux environment with Python 3.10 and the dependencies from requirement.txt installed, with the NetApp running. Use it as a template for your Dockerfile and modify it if necessary. Follow the instructions available in the template or in the Docker official documentation1 in this regard.

1 or in


# to a base image, add below required dependencies to install and execute commands

# base image in the template provides a linux environment with Python 3.10

# change base image if necessary

# dependencies of requirements.txt will be installed

# add/change commands to be executed in the container if necessary

FROM python:3.10

# FROM base_image:version

# adds a base image that provides a predefined environment-eg OS + specific programs installed

# python:3.10 Docker image from DockerHub → linux system with python 3.10 installed

# install dependencies


COPY requirements.txt requirements.txt

RUN pip3 install -r requirements.txt

# copy all files and folders of the NetApp Python project into the image

COPY . .

#execute commands in the container

CMD [ “python”, “”, “–config”, “container”, “–host=”]

# For executing the NetApp you iniciate passing 2 parameters:

#“config” is set as container to use the proper ip/ports since the Netapp is containerized

#“host” set to to make the app externally visible (outside of the container)

Finally, create the NetApp Docker image by running the following command in the same folder as the Dockerfile. Note that you define a name for the image with that command:

docker build --tag my_netapp_imv1 .

2) Create the container from the image

Note: The NEF emulator requires the name of the NetApp container for callbacks, and you MUST define this container name (e.g. my_netapp_container) when creating the Docker container and use this name with the NEF emulator.

Run the command: docker container create --name my_netapp_container my_netapp_imv1

3) Bridge network

Run the NEF emulator2 , using the container name define in previous step in the configuration. Connect the containarized NetApp to the bridge network automatically created when the NEF emulator starts (called by default nef_emulator_default ), by using the command:

docker network connect nef_emulator_default my_netapp_container

4) Start the NetApp container

Use the command: docker start my_netapp_container

The Docker Desktop app3 allows to easily check the container logs, which can also be displayed with the command docker logs –tail 100 my_netapp_container , or seen in the corresponding docker log files (/var/lib/docker/containers/<container_id>/<container_id>-json.log)

5) Run the container and bind container port to a specific port of your system

With the following command:

  • you run the container

  • and also you bind the port of the NetApp inside the container to a port of your system (-p system_port: container_port). The ports in the container are not directly accesible; this option allows access to the containarized NetApp ports via specified ports of your system.

docker run --name my_netapp_container --network nef_emulator_default -p 8080: 9877 my_netapp_v1

2Preformatted text



docker build --tag my_netapp_v1 .

docker container create --name my_netapp_container my_netapp_v1

docker network connect nef_emulator_default my_netapp_container

docker start my_netapp_container

docker run --name my_netapp_container --network nef_emulator_default --publish 9877:8080 my_netapp_v1


How to stop a container: docker stop my_netapp_container

How to delete a container (container must be stopped):

docker container rm my_netapp_container

How to delete a docker image (all associated containers must have been deleted previously):

docker rmi image_name

Check existing containers: docker ps –a

Check running containers: docker ps

Check existing images: docker images

Clean up all stopped containers: docker container prune

Clean up all images not used by any container: docker image prune –a


To facilitate the reuse and easy configuration of your NetApp, and also to avoid uploading sensitive information in GitHub, configuration parameters (e.g. endpoints, ports employed, ) must not be hardcoded in the NetApp code. Instead, they should be stored in a configuration file, and be loaded from that file in your NetApp.

Sample configuration file:


"CONF_PARAM1": “string-with-value”,
"CONF_PARAM2” : 3,
"CONF_PARAM3" : “value”,
"CONF_PARAM4_1" : “value”,
"CONF_PARAM4_2" : "value"

"CONF_PARAM5" : "value"

Code for loading the values of the configuration parameters in the NetApp:

import json #add library to imports, if not already imported

# read config.json

with open(‘config.json’, ‘r’) as file: config = json.load(file)

# now you are able to load configuration parameters into variables in your code

variable1 = config[‘CONF_PARAM1’]

variable2_in_code = config[‘CONF_PARAM4_ARRAY’][‘CONF_PARAM4_1’]

In order to avoid publishing your configuration values it in GitHub, exposing private information, add the config.json file to .gitignore to ignore it (by adding the line *config.json ).

Instead, commit a config.json.example file, containing all the configuration variables of your NetApp with blank values.