<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Koen Vervloesem - Technology Writer (Posts about docker)</title><link>https://koen.vervloesem.eu/</link><description></description><atom:link href="https://koen.vervloesem.eu/tags/docker.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Copyright © 2024 &lt;a href="mailto:koen@vervloesem.eu"&gt;Koen Vervloesem&lt;/a&gt; &lt;p xmlns:dct="http://purl.org/dc/terms/" xmlns:cc="http://creativecommons.org/ns#" class="license-text"&gt;This work by &lt;a rel="cc:attributionURL" href="mailto:koen@vervloesem.eu"&gt;&lt;span rel="cc:attributionName"&gt;Koen Vervloesem&lt;/span&gt;&lt;/a&gt; is licensed under &lt;a href="https://creativecommons.org/licenses/by-sa/4.0"&gt;CC BY-SA 4.0&lt;img style="height:22px!important;margin-left: 3px;vertical-align:text-bottom;" src="/cc.svg" /&gt;&lt;img  style="height:22px!important;margin-left: 3px;vertical-align:text-bottom;" src="/by.svg" /&gt;&lt;img  style="height:22px!important;margin-left: 3px;vertical-align:text-bottom;" src="/sa.svg" /&gt;&lt;/a&gt; | &lt;a href="/legal-notice/"&gt;Legal notice&lt;/a&gt; | &lt;a href="/privacy-policy/"&gt;Privacy policy&lt;/a&gt;&lt;/p&gt;</copyright><lastBuildDate>Sat, 07 Sep 2024 14:15:02 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Building ESP32 firmware with Espressif's IDF Docker image</title><link>https://koen.vervloesem.eu/blog/building-esp32-firmware-with-espressifs-idf-docker-image/</link><dc:creator>Koen Vervloesem</dc:creator><description>&lt;p&gt;If you're only occasionally building ESP32 firmware with &lt;a class="reference external" href="https://docs.espressif.com/projects/esp-idf/"&gt;Espressif's IoT Development Framework (ESP-IDF)&lt;/a&gt;, your current build probably fails because the installation from last time is outdated. Then you have to reinstall the newest version of the framework and its dependencies, and you probably still encounter a dependency issue. If it finally works and you have successfully built your firmware, your excitement makes up for the frustrating experience, until the next time you want to build some other ESP32 firmware, and the process repeats.&lt;/p&gt;
&lt;p&gt;But there's another way: use the &lt;a class="reference external" href="https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html#"&gt;IDF Docker image&lt;/a&gt;. It contains ESP-IDF, all the required Python packages, and all build tools such as CMake, make, ninja, and cross-compiler toolchains. In short: a ready-to-use IDF build system.&lt;/p&gt;
&lt;p&gt;Building ESP32 firmware with CMake in the container is as easy as:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code console"&gt;&lt;a id="rest_code_e06bb8fed12644519d5b62f58f868306-1" name="rest_code_e06bb8fed12644519d5b62f58f868306-1" href="https://koen.vervloesem.eu/blog/building-esp32-firmware-with-espressifs-idf-docker-image/#rest_code_e06bb8fed12644519d5b62f58f868306-1"&gt;&lt;/a&gt;&lt;span class="go"&gt;docker run --rm -v $PWD:/project -w /project espressif/idf idf.py build&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This mounts the current directory on the host (&lt;code class="docutils literal"&gt;$PWD&lt;/code&gt;) as the directory &lt;code class="docutils literal"&gt;/project&lt;/code&gt; in the container and runs the command &lt;code class="docutils literal"&gt;idf.py build&lt;/code&gt; on the code. After the build is finished, you can find your firmware in the current directory.&lt;/p&gt;
&lt;aside class="admonition note"&gt;
&lt;p class="admonition-title"&gt;Note&lt;/p&gt;
&lt;p&gt;If you're building a project that needs a specific version of ESP-IDF, just use a tag such as &lt;code class="docutils literal"&gt;espressif/idf:v4.2.1&lt;/code&gt; instead of &lt;code class="docutils literal"&gt;espressif/idf&lt;/code&gt;. You can find the &lt;a class="reference external" href="https://hub.docker.com/r/espressif/idf/tags"&gt;available tags on Docker Hub&lt;/a&gt;.&lt;/p&gt;
&lt;/aside&gt;
&lt;p&gt;The same works if the project is using &lt;code class="docutils literal"&gt;make&lt;/code&gt; for its build:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code console"&gt;&lt;a id="rest_code_a0d942dde0304d5bb3a54f8159dcf0a7-1" name="rest_code_a0d942dde0304d5bb3a54f8159dcf0a7-1" href="https://koen.vervloesem.eu/blog/building-esp32-firmware-with-espressifs-idf-docker-image/#rest_code_a0d942dde0304d5bb3a54f8159dcf0a7-1"&gt;&lt;/a&gt;&lt;span class="go"&gt;docker run --rm -v $PWD:/project -w /project espressif/idf make defconfig all -j4&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can also &lt;a class="reference external" href="https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html#using-the-image-interactively"&gt;use the container interactively&lt;/a&gt;.&lt;/p&gt;</description><category>docker</category><category>esp32</category><category>esp-idf</category><category>espressif</category><category>iot</category><guid>https://koen.vervloesem.eu/blog/building-esp32-firmware-with-espressifs-idf-docker-image/</guid><pubDate>Sun, 16 May 2021 18:49:19 GMT</pubDate></item></channel></rss>