{"id":1331,"date":"2025-05-02T00:00:00","date_gmt":"2025-05-01T22:00:00","guid":{"rendered":"https:\/\/demo.sidekick.be\/itenium\/ml-net-lightgbm-docker\/"},"modified":"2025-11-28T13:31:41","modified_gmt":"2025-11-28T12:31:41","slug":"ml-net-lightgbm-docker","status":"publish","type":"post","link":"https:\/\/demo.sidekick.be\/itenium\/blog\/docker\/ml-net-lightgbm-docker\/","title":{"rendered":"Training with ML.NET and LightGBM on Synology with Docker"},"content":{"rendered":"<h1 id=\"docker-training\">Docker Training<\/h1>\n<p>As, once deployed, training failed with:<\/p>\n<p class=\"notice--danger\"><strong>System.DllNotFoundException<\/strong>: Unable to load shared library \u2018lib_lightgbm\u2019 or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you\u2019re using glibc, consider setting the LD_DEBUG environment variable:<br \/> libgomp.so.1: cannot open shared object file: No such file or directory<br \/> \/app\/lib_lightgbm.so: cannot open shared object file: No such file or directory<\/p>\n<p>It\u2019s a conscious decision by the team to not include LightGBM by default, and that makes perfect since it is a 1gig dependency which is only used when using that trainer.<\/p>\n<h1 id=\"installing-lightgbm\">Installing LightGBM<\/h1>\n<p>A simple Google search got me to the LightGBM installation instructions:<\/p>\n<pre><code class=\"language-sh\">git clone --recursive https:\/\/github.com\/microsoft\/LightGBM.git\ncd LightGBM &amp;&amp; mkdir build &amp;&amp; cd build\ncmake .. &amp;&amp; make -j &amp;&amp; make install\n<\/code><\/pre>\n<h2 id=\"cmake-detour\">CMake Detour<\/h2>\n<p>The <code>apt-get install cmake -y<\/code> installed version 3.25.1 which was just not good enough for LightGBM!<\/p>\n<p class=\"notice--danger\">CMake 3.28 or higher is required. You are running version 3.25.1<\/p>\n<p>And now it was really starting to show that I\u2019m very far from a Linux installation\/compilation hero. After trying to build CMake for a few hours, I ended up installing <code>pip<\/code> to install CMake with.<\/p>\n<pre><code class=\"language-sh\">apt-get install python3-pip -y\npip install cmake --upgrade --break-system-packages\n\n# Check version:\ncmake --version\n<\/code><\/pre>\n<p>The <code>--break-system-packages<\/code> obviously isn\u2019t a very good sign but since we will be doing this in the build step of our Dockerfile, it\u2019s fine \ud83d\ude05<\/p>\n<h1 id=\"final-dockerfile\">Final Dockerfile<\/h1>\n<pre><code class=\"language-sh\">FROM mcr.microsoft.com\/dotnet\/sdk:8.0 AS build\n\nRUN apt-get update\nRUN apt-get install git clang-3.9 libunwind8 curl libomp-dev -y\n\nRUN apt-get install python3-pip -y\nRUN pip install cmake --upgrade --break-system-packages\n\nRUN git clone --recursive https:\/\/github.com\/microsoft\/LightGBM.git\nRUN cd LightGBM &amp;&amp; mkdir build &amp;&amp; cd build &amp;&amp; cmake .. &amp;&amp; make -j &amp;&amp; make install\n\n# Usual steps for building the .NET app\n# dotnet restore\/publish etc\n\nFROM mcr.microsoft.com\/dotnet\/aspnet:8.0 as runtime\n\nCOPY --from=build \/app \/app\nCOPY --from=build \/usr\/local\/lib\/lib_lightgbm.so \/usr\/local\/lib\/lib_lightgbm.so\nCOPY --from=build \/usr\/lib\/x86_64-linux-gnu\/libgomp.so.1 \/usr\/lib\/x86_64-linux-gnu\/libgomp.so.1\n\nENTRYPOINT [ \"dotnet\", \"\/app\/WebApi.dll\" ]\n<\/code><\/pre>\n<p>I figured out which files needed to be copied with the following command:<\/p>\n<pre><code class=\"language-sh\"># Enter running container\n# (with lightgbm installed)\ndocker exec -it lightgbm bash\n\n# Find location\nfind \/ -name 'lib_lightgbm.so' 2&gt;\/dev\/null\n\n# List dynamic dependencies\nldd \/usr\/local\/lib\/lib_lightgbm.so\n<\/code><\/pre>\n<p>And there we have it, a WebApi that creates the models!<\/p>\n<h1>Extras<\/h1>\n<p><b>Stuff that came into being during the making of this post<\/b><\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/TTC-AAlst\/PongRank\">Predicting next year player rankings<\/a><\/li>\n<\/ul>\n<p><b>Other interesting reads<\/b><\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/dotnet\/machinelearning\/issues\/7454\">Issue: LightGbm in Linux Container<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p><a href=\"https:\/\/github.com\/dotnet\/machinelearning\" class=\"github\"><img decoding=\"async\" src=\"https:\/\/img.shields.io\/github\/stars\/dotnet\/machinelearning.svg?style=social&amp;label=Star\" \/><\/a><a href=\"https:\/\/github.com\/dotnet\/machinelearning\">dotnet\/machinelearning<\/a>: ML.NET is an open source and cross-platform machine learning framework for .NET. <a href=\"https:\/\/github.com\/microsoft\/LightGBM\" class=\"github\"><img decoding=\"async\" src=\"https:\/\/img.shields.io\/github\/stars\/microsoft\/LightGBM.svg?style=social&amp;label=Star\" \/><\/a><a href=\"https:\/\/github.com\/microsoft\/LightGBM\">microsoft\/LightGBM<\/a>: A fast, distributed, high performance gradient boosting (GBT, GBDT, GBRT, GBM or MART) framework based on decision tree algorithms, used for ranking, classification and many other machine learning tasks.<\/p>\n<p>After writing some code to fetch and mold the data, I was ready to train \u201cmy\u201d AI, dubbed \u201cPongRank\u201d which was easy enough and all was good until I added a small WebApi to automate future syncing, retraining and predictions.<\/p>\n","protected":false},"author":1,"featured_media":1951,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[16],"tags":[18,17,10],"class_list":["post-1331","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-docker","tag-net","tag-synology","tag-war-story"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Training with ML.NET and LightGBM on Synology with Docker - Itenium<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Training with ML.NET and LightGBM on Synology with Docker - Itenium\" \/>\n<meta property=\"og:description\" content=\"dotnet\/machinelearning: ML.NET is an open source and cross-platform machine learning framework for .NET. microsoft\/LightGBM: A fast, distributed, high performance gradient boosting (GBT, GBDT, GBRT, GBM or MART) framework based on decision tree algorithms, used for ranking, classification and many other machine learning tasks.After writing some code to fetch and mold the data, I was ready to train \u201cmy\u201d AI, dubbed \u201cPongRank\u201d which was easy enough and all was good until I added a small WebApi to automate future syncing, retraining and predictions.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/demo.sidekick.be\/itenium\/blog\/docker\/ml-net-lightgbm-docker\/\" \/>\n<meta property=\"og:site_name\" content=\"Itenium\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-01T22:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-28T12:31:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/ml-net-lightgbm.png\" \/>\n\t<meta property=\"og:image:width\" content=\"360\" \/>\n\t<meta property=\"og:image:height\" content=\"300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Usdevelop\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Usdevelop\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/docker\/ml-net-lightgbm-docker\/\",\"url\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/docker\/ml-net-lightgbm-docker\/\",\"name\":\"Training with ML.NET and LightGBM on Synology with Docker - Itenium\",\"isPartOf\":{\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/docker\/ml-net-lightgbm-docker\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/docker\/ml-net-lightgbm-docker\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/ml-net-lightgbm.png\",\"datePublished\":\"2025-05-01T22:00:00+00:00\",\"dateModified\":\"2025-11-28T12:31:41+00:00\",\"author\":{\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/6ab401ce01e858184ee4a8667fe0f022\"},\"breadcrumb\":{\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/docker\/ml-net-lightgbm-docker\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/demo.sidekick.be\/itenium\/blog\/docker\/ml-net-lightgbm-docker\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/docker\/ml-net-lightgbm-docker\/#primaryimage\",\"url\":\"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/ml-net-lightgbm.png\",\"contentUrl\":\"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/ml-net-lightgbm.png\",\"width\":360,\"height\":300,\"caption\":\"A heroic Linux penguin wielding a keyboard sword, battling giant digital dragons labeled 'lib_lightgbm.so' and 'libgomp.so.1', inside a dark futuristic server cave, glowing error messages flying through the air, Docker container shields, epic fantasy-tech crossover, humorous tone, digital fantasy art, high detail, vibrant lighting\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/docker\/ml-net-lightgbm-docker\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/demo.sidekick.be\/itenium\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Training with ML.NET and LightGBM on Synology with Docker\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/#website\",\"url\":\"https:\/\/demo.sidekick.be\/itenium\/\",\"name\":\"Itenium\",\"description\":\"We build software. We build careers.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/demo.sidekick.be\/itenium\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/6ab401ce01e858184ee4a8667fe0f022\",\"name\":\"Usdevelop\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cc8cf9b9e9d5bbe7e8d247907cc9ac8457bbfa2854b52eaddf6529adfe88ceab?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cc8cf9b9e9d5bbe7e8d247907cc9ac8457bbfa2854b52eaddf6529adfe88ceab?s=96&d=mm&r=g\",\"caption\":\"Usdevelop\"},\"sameAs\":[\"https:\/\/demo.sidekick.be\/itenium\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Training with ML.NET and LightGBM on Synology with Docker - Itenium","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"Training with ML.NET and LightGBM on Synology with Docker - Itenium","og_description":"dotnet\/machinelearning: ML.NET is an open source and cross-platform machine learning framework for .NET. microsoft\/LightGBM: A fast, distributed, high performance gradient boosting (GBT, GBDT, GBRT, GBM or MART) framework based on decision tree algorithms, used for ranking, classification and many other machine learning tasks.After writing some code to fetch and mold the data, I was ready to train \u201cmy\u201d AI, dubbed \u201cPongRank\u201d which was easy enough and all was good until I added a small WebApi to automate future syncing, retraining and predictions.","og_url":"https:\/\/demo.sidekick.be\/itenium\/blog\/docker\/ml-net-lightgbm-docker\/","og_site_name":"Itenium","article_published_time":"2025-05-01T22:00:00+00:00","article_modified_time":"2025-11-28T12:31:41+00:00","og_image":[{"width":360,"height":300,"url":"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/ml-net-lightgbm.png","type":"image\/png"}],"author":"Usdevelop","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Usdevelop","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/docker\/ml-net-lightgbm-docker\/","url":"https:\/\/demo.sidekick.be\/itenium\/blog\/docker\/ml-net-lightgbm-docker\/","name":"Training with ML.NET and LightGBM on Synology with Docker - Itenium","isPartOf":{"@id":"https:\/\/demo.sidekick.be\/itenium\/#website"},"primaryImageOfPage":{"@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/docker\/ml-net-lightgbm-docker\/#primaryimage"},"image":{"@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/docker\/ml-net-lightgbm-docker\/#primaryimage"},"thumbnailUrl":"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/ml-net-lightgbm.png","datePublished":"2025-05-01T22:00:00+00:00","dateModified":"2025-11-28T12:31:41+00:00","author":{"@id":"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/6ab401ce01e858184ee4a8667fe0f022"},"breadcrumb":{"@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/docker\/ml-net-lightgbm-docker\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/demo.sidekick.be\/itenium\/blog\/docker\/ml-net-lightgbm-docker\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/docker\/ml-net-lightgbm-docker\/#primaryimage","url":"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/ml-net-lightgbm.png","contentUrl":"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/ml-net-lightgbm.png","width":360,"height":300,"caption":"A heroic Linux penguin wielding a keyboard sword, battling giant digital dragons labeled 'lib_lightgbm.so' and 'libgomp.so.1', inside a dark futuristic server cave, glowing error messages flying through the air, Docker container shields, epic fantasy-tech crossover, humorous tone, digital fantasy art, high detail, vibrant lighting"},{"@type":"BreadcrumbList","@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/docker\/ml-net-lightgbm-docker\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/demo.sidekick.be\/itenium\/"},{"@type":"ListItem","position":2,"name":"Training with ML.NET and LightGBM on Synology with Docker"}]},{"@type":"WebSite","@id":"https:\/\/demo.sidekick.be\/itenium\/#website","url":"https:\/\/demo.sidekick.be\/itenium\/","name":"Itenium","description":"We build software. We build careers.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/demo.sidekick.be\/itenium\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/6ab401ce01e858184ee4a8667fe0f022","name":"Usdevelop","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cc8cf9b9e9d5bbe7e8d247907cc9ac8457bbfa2854b52eaddf6529adfe88ceab?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cc8cf9b9e9d5bbe7e8d247907cc9ac8457bbfa2854b52eaddf6529adfe88ceab?s=96&d=mm&r=g","caption":"Usdevelop"},"sameAs":["https:\/\/demo.sidekick.be\/itenium"]}]}},"_links":{"self":[{"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/posts\/1331","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/comments?post=1331"}],"version-history":[{"count":3,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/posts\/1331\/revisions"}],"predecessor-version":[{"id":2251,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/posts\/1331\/revisions\/2251"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/media\/1951"}],"wp:attachment":[{"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/media?parent=1331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/categories?post=1331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/tags?post=1331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}