docker on windows virtual machine + raspberry

Costas

Administrator
Staff member
#1#
https://www.docker.com/get-started/
https://docs.docker.com/get-started/docker_cheatsheet.pdf
https://hub.docker.com/search?q=elastic
https://docs.docker.com/desktop/
https://labs.play-with-docker.com/

download AMD64 (latest at the moment) v4.36 (2024 build) 494mb

Docker Desktop requires Windows 10 Pro/Enterprise/Home version 19044 or above.

Brjuq5M.jpeg
cmd executing winver
bylhIPX.jpeg

regedit.exe > HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion


Docker Desktop requires the Server service to be enabled.


RSjAUSo.jpeg

tried in 3 computers Windows10_22H2_19045, none has this 'Server' service, to apply possible fix as described here.

5I5tSsR.jpeg

#2#
download v2.1.0.5 (2019 build) 836mb (ref)
https://docs.docker.com/desktop/release-notes/
could not find what I missing!
yZ9OgTV.jpeg
Docker doesn't support your Windows version. Check documentation for minimum requirements
Solution : Make sure you have Hyper-V enabled.

DockerDesktopVM is not running under Virtual Machines

cvTxRS0.jpeg

User must use Windows containers when installing docker on virtual machine. (ref)

ColOnn6.jpeg

As there are no official support for Elasticsearch Windows docker images this guy made elasticsearch-windows-docker supporting up to v7.x
 

Costas

Administrator
Staff member
Raspberry with DietPi (debian) - Elasticsearch + Kibana + Serilog

Bash:
# create 'user-defined' type network named elastic (we gonna add alone elasticsearch + kibana to this 'container')
# find more about docker networks here - https://www.youtube.com/watch?v=bKFMS5C4CG0
docker network create elastic

# run Elasticsearch
docker run -d --name elasticsearch --network elastic -e "discovery.type=single-node" -p 9200:9200 -e "ES_JAVA_OPTS=-Xms512m -Xmx512m" docker.elastic.co/elasticsearch/elasticsearch:8.0.0

# run Kibana
docker run -d --name kibana --network elastic -p 5601:5601 docker.elastic.co/kibana/kibana:8.0.0

--

# install dotnet v8
Bash:
sudo apt install -y wget apt-transport-https
wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
# --notworking--forget--sudo apt install -y dotnet-sdk-8.0
# --notworking--forget--https://learn.microsoft.com/en-us/dotnet/core/install/linux-debian?tabs=dotnet8
# you have to go to https://dotnet.microsoft.com/en-us/download/dotnet/8.0 OR https://versionsof.net/core/8.0/8.0.11/
# download the arm64 by hand follow the cmds on arm64 page

Bash:
# create new dotnet project
dotnet new console -n MyLoggingApp
cd MyLoggingApp

# add Serilog references
dotnet add package Serilog
dotnet add package Serilog.Sinks.Console
dotnet add package Serilog.Sinks.Elasticsearch

# alter program.cs write some Serilog code to
C#:
using Serilog;
using Serilog.Sinks.Elasticsearch;

public class Program
{
    public static void Main(string[] args)
    {
        Log.Logger = new LoggerConfiguration()
            .Enrich.FromLogContext()
            .WriteTo.Console() // Ensure this is available
            .WriteTo.Elasticsearch(new ElasticsearchSinkOptions(new Uri("http://elasticsearch:9200"))
            {
                AutoRegisterTemplate = true,
            })
            .CreateLogger();

        try
        {
            Log.Information("Starting up the application");
            for (int i = 0; i < 10; i++)
            {   // Simulate some work
                Log.Information("Logging message {MessageNumber}", i);
            }
        }
        catch (Exception ex)
        {            Log.Fatal(ex, "Application start-up failed");        }
        finally
        {            Log.CloseAndFlush();        }
    }
}

# near program.cs create a new filename dockerfile
Bash:
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /app
COPY . .
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/runtime:8.0
WORKDIR /app
COPY --from=build /app/out .
ENTRYPOINT ["dotnet", "MyLoggingApp.dll"]

Bash:
# build docker
docker build -t myloggingapp .

# run the application
docker run --network elastic --name myloggingapp myloggingapp

# on another lan-PC, browse to Kibana
http://192.168.1.155:5601/

eaji5CX.jpeg

continue with guide - https://www.elastic.co/guide/en/elasticsearch/reference/current/create-enrollment-token.html



others commands used on this session :
Bash:
# once docker installed
ip address show
## here we see the docker0 a new interface, see the connected with `bridge link`

# retrieve hello-world from docker hub
docker run hello-world

# view the docker images on your system
docker images

# to get details of the image
docker inspect hello-world

# see current 'Docker Networks' exist to docker
docker network ls

# list all images with their size and ports
docker ps -a --size
docker images --format "{{.Repository}}: {{.Size}}"

for your reference, docker images size
hBMkklo.jpeg

COMPONENTDESCRIPTIONCORRELATION
DockerA platform for developing, shipping, and running applications in containers.Can host applications that use Serilog for logging and connect to Elasticsearch for log storage.
ElasticsearchA distributed search and analytics engine for storing and indexing data.Receives structured logs from Serilog and serves as the backend for Kibana visualizations.
KibanaA data visualization and exploration tool for the Elastic Stack.Visualizes logs stored in Elasticsearch, which are generated by applications using Serilog.
SerilogA logging library for .NET applications that provides structured logging capabilities.Sends structured logs directly to Elasticsearch, enabling visualization in Kibana.
 
Top