Setting Up ntopng with Docker for Network Traffic Analysis

Introduction:
ntopng is a network traffic analysis tool that provides detailed real-time insights into your network’s traffic. By using Docker, you can easily deploy ntopng with its required configurations. In this guide, we’ll show you how to set up ntopng using Docker with the necessary parameters for network monitoring.

Step 1: Install Docker
Before proceeding, ensure you have Docker installed on your system. If you haven’t installed Docker yet, follow the official Docker installation instructions for your operating system.

Step 2: Run ntopng Docker Container
Run the following command to create and start the ntopng Docker container:

docker run -it \
--name ntopng \
-p 3000:3000/tcp \
-p 2055:2055/udp \
-e ACCOUNTID="xxxxx" \
-e LICENSEKEY="xxxxxxxxx" \
-e LOCALNET="192.168.0.0/24" \
-v ntopng_data:/var/lib/ntopng \
--restart unless-stopped \
--net=host \
phantomski/ntopng

Explanation of options used:

  • -it: Allocate a pseudo-TTY and keep STDIN open, allowing you to interact with the ntopng console if needed.
  • --name ntopng: Assign the name “ntopng” to the container for easy management.
  • -p 3000:3000/tcp: Map port 3000 from the container to the host system. This allows you to access the ntopng web interface at http://localhost:3000.
  • -p 2055:2055/udp: Map port 2055 from the container to the host system. This is used for ntopng to receive NetFlow/sFlow data from devices on the network.
  • -e ACCOUNTID="xxxxxx": Set the ntopng Account ID. Replace “xxxxx” with your ntopng account ID obtained from the ntopng website.
  • -e LICENSEKEY="xxxxxxxxxx": Set the ntopng License Key. Replace “xxxxxxxxx” with your ntopng license key obtained from the ntopng website.
  • -e LOCALNET="192.168.0.0/24": Specify the local network to be monitored. Replace “192.168.0.0/24” with your network’s subnet.
  • -v ntopng_data:/var/lib/ntopng: Create a Docker volume named “ntopng_data” and mount it to the /var/lib/ntopng directory inside the container. This volume allows you to persist ntopng data and configurations.
  • --restart unless-stopped: Configure the container to automatically restart if it stops unexpectedly.
  • --net=host: Use the host’s network stack to simplify network configuration and improve performance.

Step 3: Access ntopng Web Interface
Once the ntopng container is running, you can access the ntopng web interface by opening a web browser and navigating to http://localhost:3000. From here, you can explore the real-time network traffic data and analytics provided by ntopng.

Conclusion:
You’ve successfully set up ntopng with Docker, allowing you to monitor and analyze network traffic in real-time. ntopng’s web interface provides comprehensive insights into your network, helping you identify and troubleshoot potential issues. With Docker, managing ntopng becomes easier, and you can quickly deploy it in your network environment.

Happy network monitoring!




Setting Up Node-RED with Docker and Managing Backups

Introduction:
Node-RED is a powerful visual programming tool that allows you to easily create and manage flows for IoT applications. With Docker, you can run Node-RED in a containerized environment, making it portable and easy to maintain. In this guide, we’ll show you how to install Node-RED using Docker and manage backups for your flows.

Step 1: Install Node-RED with Docker
To install Node-RED, run the following Docker command:

docker run -d -p 1880:1880 -v nodered_data:/data --name mynodered nodered/node-red:latest

Explanation of options used:

  • -d: Run the container in the background (detached mode).
  • -p 1880:1880: Map port 1880 from the container to the host system. This allows you to access Node-RED from http://localhost:1880.
  • -v nodered_data:/data: Create a Docker volume named “nodered_data” and mount it to the /data directory inside the container. This volume allows you to persist Node-RED data and configurations.
  • --name mynodered: Assign the name “mynodered” to the container for easy management.
  • nodered/node-red:latest: Use the latest Node-RED Docker image from Docker Hub.

Step 2: Creating a Backup Volume
To create a backup of your Node-RED flows and configurations, you can use the docker cp command. This command allows you to copy files and directories from a container to your host system.

docker cp mynodered:/data /your/backup/directory

Replace /your/backup/directory with the desired backup destination on your host system. This command will copy the contents of the /data directory inside the Node-RED container to your specified backup directory.

Step 3: Stopping Node-RED
To stop the Node-RED container, use the following command:

docker stop mynodered

This command will gracefully stop the Node-RED container, allowing any ongoing flows to finish processing.

Step 4: Deleting Node-RED Container
If you want to remove the Node-RED container, use the following command:

docker rm mynodered

This command will remove the “mynodered” container, but the data and configurations stored in the “nodered_data” volume will be preserved.

Conclusion:
You’ve successfully installed Node-RED using Docker, allowing you to easily manage and visualize your IoT application flows. Docker makes Node-RED deployment and maintenance a breeze, and you can also create backups of your flows and configurations for safekeeping. With Docker’s portability and scalability, you can take advantage of Node-RED’s full potential.

Happy flow building!




Setting Up a Minecraft Server with Docker

Introduction:
Minecraft is a popular sandbox video game, and with Docker, you can easily create and manage a Minecraft server. Docker allows you to encapsulate the server environment, making it easy to deploy and maintain. In this guide, we’ll show you how to set up a Minecraft server using Docker and configure its settings.

Step 1: Install Docker
Before proceeding, ensure you have Docker installed on your system. If you haven’t installed Docker yet, follow the official Docker installation instructions for your operating system.

Step 2: Pull the Minecraft Server Docker Image
To run the Minecraft server, pull the latest Minecraft Server Docker image from Docker Hub using the following command:

docker pull itzg/minecraft-server:latest

Step 3: Create and Start the Minecraft Server Container
Run the following command to create and start the Minecraft server container:

docker run -d -it --name minecraft -v minecraft_data:/data -p 25565:25565 -e EULA=TRUE -e MODE=creative -e MEMORY=2G -e tty=true --restart always itzg/minecraft-server:latest

Explanation of options used:

  • -d: Run the container in the background (detached mode).
  • -it: Allocate a pseudo-TTY and keep STDIN open, allowing you to interact with the server console.
  • --name minecraft: Assign the name “minecraft” to the container for easy management.
  • -v minecraft_data:/data: Create a Docker volume named “minecraft_data” and mount it to the /data directory inside the container. This volume allows you to persist Minecraft world data and configurations.
  • -p 25565:25565: Map port 25565 from the container to the host system. This is the default port for Minecraft servers.
  • -e EULA=TRUE: Accept the Minecraft End User License Agreement (EULA).
  • -e MODE=creative: Set the server mode to “creative.” You can change this to “survival” or other valid game modes.
  • -e MEMORY=2G: Set the allocated memory for the server to 2GB. Adjust this value based on your server’s requirements.
  • -e tty=true: Enable the TTY (Terminal) for interacting with the server console.
  • --restart always: Configure the container to automatically restart if it stops unexpectedly.

Step 4: Access the Minecraft Server Console
To access the Minecraft server console interactively, use the following command:

docker attach minecraft

This command will attach your current terminal to the running Minecraft server container, providing you with an interactive console to manage the server.

Step 5: Clean Up
If you want to stop and remove the Minecraft server container and the associated volume, use the following commands:

docker stop minecraft
docker rm minecraft
docker volume rm minecraft_data

Conclusion:
You’ve successfully set up a Minecraft server using Docker, allowing you to host and manage your Minecraft world easily. Docker’s portability and isolation make it a convenient choice for running a Minecraft server without interfering with your host system. Enjoy playing and exploring your Minecraft creations!

Happy mining!




Installing Jellyfin Media Server with Docker

Introduction:
Jellyfin is an open-source media server that allows you to organize, stream, and access your media content from various devices. By using Docker, we can easily set up Jellyfin and manage its configuration and data in isolated containers. In this guide, we’ll show you how to install Jellyfin using Docker and ensure it starts automatically.

Step 1: Install Docker
Before proceeding, ensure you have Docker installed on your system. If you haven’t installed Docker yet, follow the official Docker installation instructions for your operating system.

Step 2: Pull Jellyfin Docker Image
To install Jellyfin, pull the latest Docker image from Docker Hub using the following command:

docker pull jellyfin/jellyfin:latest

Step 3: Create a Docker Container for Jellyfin
Run the following command to create a Docker container for Jellyfin with proper volume and network configurations:

docker run -d --restart always --name jellyfin -v jellyfin_config:/config -v jellyfin_cache:/cache -v jellyfin_media:/media --net=host jellyfin/jellyfin:latest

Explanation of options used:

  • -d: Run the container in the background (detached mode).
  • --restart always: Configure the container to automatically restart if it stops unexpectedly.
  • --name jellyfin: Assign the name “jellyfin” to the container for easy management.
  • -v jellyfin_config:/config: Create a Docker volume named “jellyfin_config” to persist the Jellyfin configuration data.
  • -v jellyfin_cache:/cache: Create a Docker volume named “jellyfin_cache” to store the Jellyfin cache data.
  • -v jellyfin_media:/media: Create a Docker volume named “jellyfin_media” to mount your media content.
  • --net=host: Use the host’s network stack to simplify network configuration and improve performance.

Step 4: Access Jellyfin
Once the Jellyfin container is running, you can access the Jellyfin web interface by opening a web browser and navigating to http://localhost:8096. From here, you can set up Jellyfin and start adding your media libraries.

Step 5: Clean Up
If you want to stop and remove the Jellyfin container and volumes, use the following commands:

docker stop jellyfin
docker rm jellyfin
docker volume rm jellyfin_config jellyfin_cache jellyfin_media

Conclusion:
You’ve successfully installed Jellyfin media server using Docker, providing a powerful platform to organize and stream your media content across devices. Docker allows you to manage Jellyfin in an isolated and portable environment, ensuring easy setup and deployment. Enjoy exploring Jellyfin’s features and transforming your Raspberry Pi into a media powerhouse!

Happy media streaming!




Setting Up Drupal with Docker Compose

Introduction:
Drupal is a popular content management system that allows you to create and manage websites with ease. By using Docker, we can quickly set up Drupal along with its MariaDB database, making the deployment process straightforward and portable. In this guide, we’ll show you how to run Drupal and MariaDB containers with Docker Compose.

Step 1: Install Docker and Docker Compose
Before proceeding, ensure you have Docker and Docker Compose installed on your system. If not, follow the official Docker installation instructions for your operating system.

Step 2: Create a Docker Compose File
Create a new directory for your Drupal project and navigate into it:

mkdir drupal_project
cd drupal_project

Inside the drupal_project directory, create a docker-compose.yml file using a text editor of your choice (e.g., nano, vi, or vim), and add the following content:

version: '3'

services:
  drupaldb:
    image: mariadb:latest
    environment:
      MYSQL_ROOT_PASSWORD: drupal
      MYSQL_DATABASE: drupal
    volumes:
      - drupal_mariadb_data:/var/lib/mysql
    container_name: drupaldb
    restart: always

  drupal:
    image: drupal:latest
    ports:
      - "80:80"
    environment:
      DRUPAL_DB_USER: root
      DRUPAL_DB_PASSWORD: drupal
    volumes:
      - drupal_data:/var/www/html
    container_name: drupal
    depends_on:
      - drupaldb
    restart: always

volumes:
  drupal_mariadb_data:
  drupal_data:

Save the file and exit the editor.

Step 3: Start the Containers
To create and start the Drupal and MariaDB containers, run the following command inside the drupal_project directory:

docker-compose up -d

Docker Compose will pull the required images (if not already available locally) and start the containers in the background.

Step 4: Access Drupal
Once the containers are running, you can access your Drupal site by opening a web browser and navigating to http://localhost. The Drupal installation wizard will guide you through the setup process.

Step 5: Cleanup
If you want to stop and remove the containers and volumes created by Docker Compose, use the following command:

docker-compose down

Conclusion:
Congratulations! You’ve successfully set up Drupal with Docker Compose, providing a scalable and easily manageable environment for your website. Docker Compose simplifies the process of managing multi-container applications, making it ideal for running Drupal alongside its MariaDB database. Now you can focus on building your Drupal website without worrying about the complexities of server setup.

Happy Drupal development!




Installing Docker Compose on Raspberry Pi

Introduction:
With Docker Compose, you can define and run multi-container Docker applications easily. In this guide, we’ll walk you through the steps to install Docker Compose on your Raspberry Pi, so you can manage complex applications using Docker containers effortlessly.

Prerequisites:
Before proceeding with the installation, make sure you have Docker already installed on your Raspberry Pi. If not, please refer to our previous blog post on “Setting up Docker on Raspberry Pi” to get Docker up and running.

Step 1: Update Your System
As a best practice, always update your package lists before installing any new software. Run the following command to update your Raspberry Pi:

sudo apt update

Step 2: Install Docker Compose
Docker Compose can be installed using pip, the Python package manager. To install pip on your system, run the following command:

sudo apt install python3-pip

Once pip is installed, you can proceed to install Docker Compose:

sudo pip3 install docker-compose

Step 3: Verify Installation
After the installation is complete, verify that Docker Compose is installed and accessible by checking its version:

docker-compose --version

This command will display the version of Docker Compose if the installation was successful.

Step 4: Test Docker Compose
Now that Docker Compose is installed, you can test it by creating a simple Docker Compose file and running a container.

Create a new directory and navigate into it:

mkdir docker_test
cd docker_test

Create a docker-compose.yml file using a text editor of your choice (e.g., nano, vi, or vim) with the following contents:

version: '3'
services:
  web:
    image: nginx
    ports:
      - "80:80"

Save the file and exit the editor.

Run the following command to start the Nginx web server using Docker Compose:

docker-compose up -d

Step 5: Test the Web Server
To verify that the Nginx web server is running, open a web browser and enter your Raspberry Pi’s IP address. You should see the default Nginx welcome page.

Step 6: Stop and Remove Containers
To stop and remove the containers defined in your docker-compose.yml file, run the following command:

docker-compose down

Conclusion:
Congratulations! You have successfully installed Docker Compose on your Raspberry Pi, allowing you to manage multi-container applications effortlessly. With Docker Compose, you can define complex services and their dependencies in a single file, making it easier to deploy and manage your applications. Enjoy experimenting with Docker Compose and exploring the world of containerized applications on your Raspberry Pi.

Happy containerizing!




Setting up Docker on Raspberry Pi: A Step-by-Step Guide

Introduction:
Raspberry Pi is a versatile mini-computer, and with the growing popularity of containerization, using Docker on a Raspberry Pi can open up exciting possibilities. In this guide, we will walk you through the steps to set up Docker on your Raspberry Pi so that you can leverage the power of containerization for your projects.

Before you start:
Make sure you have a Raspberry Pi up and running with the Raspbian OS or its derivatives. Additionally, ensure you have a stable internet connection to proceed with the installation.

Step 1: Editing cmdline.txt
To enable memory control and avoid issues with mem management, we need to make some adjustments to the cmdline.txt file. Open the file using the following command:

sudo vi /boot/cmdline.txt

Add the following lines at the end of the file:

cgroup_enable=memory swapaccount=1 cgroup_memory=nokmem cgroup_enable=cpuset

Save the changes and exit the editor.

Step 2: Adjusting GPU memory
To ensure smooth performance with Docker, it is recommended to allocate at least 128MB of GPU memory. Use the following steps to make the adjustment:

  • Open the raspi-config tool:
sudo raspi-config

  • Navigate to “Advanced Options” and then “Memory Split.”
  • Set the GPU memory to 128MB.
  • Save the changes and exit the configuration tool.

Step 3: Updating your system
Before installing Docker, it’s essential to have your system up-to-date. Run the following commands to update your Raspberry Pi:

sudo apt update
sudo apt upgrade -y
sudo rpi-update
sudo reboot
sudo rpi-eeprom-update -a
sudo reboot

Step 4: Installing Docker
Now, it’s time to install Docker on your Raspberry Pi. Execute the following commands:

sudo curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo reboot

Step 5: Granting permissions for Docker
To run Docker commands without using sudo, add your user to the “docker” group:

sudo groupadd docker
sudo usermod -aG docker $USER

Make sure to log out and log back in to apply the changes.

Conclusion:
Congratulations! You have successfully set up Docker on your Raspberry Pi, allowing you to harness the power of containerization for your projects. Docker provides an efficient way to manage applications and services, making development and deployment a breeze on your Raspberry Pi. Enjoy exploring the world of containers and unleash the full potential of your tiny yet powerful computing companion.

Happy coding!