<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: AndreasHeissenberger</title>
    <description>The latest articles on DEV Community by AndreasHeissenberger (@aheissenberger).</description>
    <link>https://dev.to/aheissenberger</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F355997%2Fcee51c6e-5cd7-4d1f-bbf6-4d27a21e16b0.jpg</url>
      <title>DEV Community: AndreasHeissenberger</title>
      <link>https://dev.to/aheissenberger</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aheissenberger"/>
    <language>en</language>
    <item>
      <title>Beyond Next.js: Exploring Alternative React Server Component Frameworks</title>
      <dc:creator>AndreasHeissenberger</dc:creator>
      <pubDate>Thu, 05 Dec 2024 02:45:24 +0000</pubDate>
      <link>https://dev.to/aheissenberger/beyond-nextjs-exploring-alternative-react-server-component-frameworks-4909</link>
      <guid>https://dev.to/aheissenberger/beyond-nextjs-exploring-alternative-react-server-component-frameworks-4909</guid>
      <description>&lt;h2&gt;
  
  
  What is the current deal with React Server Components (RSC)?
&lt;/h2&gt;

&lt;p&gt;When in late 2020 the React team introduced the "Zero-Bundle-Size React Server Components" concept, many people have been and are still struggle to understand it. None of the existing frameworks supported the new concept and the prototypes did not provide a usable base to build real world applications.&lt;/p&gt;

&lt;p&gt;Now, more than 4 years later, the required version of react is still in beta and not released for production and the only big and well-known framework which supports it is staffed by ex-react team members. This is a very sad situation for the few developers which have tried to offer alternative frameworks based on RSC.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why would I need RSC?
&lt;/h3&gt;

&lt;p&gt;The normal React is a library which only focused on providing a fast declarative solution to build application in the browser. Applications in the browser always need a server to fetch and store their state. Based on this fact a huge number of solutions have been developed and exist in the react client eco system. When more and more people started to create their backend with Typescript, the next trend where a renaissance of RPC with typed interfaces which created the api end points in the background.&lt;/p&gt;

&lt;p&gt;Looking at RSC with these requirements it becomes quickly clear that all of this has been in the scope for RSCs as they provide:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;typed server actions which can return typed values and promises&lt;/li&gt;
&lt;li&gt;single server request to mutate data on the server and update client-side UI&lt;/li&gt;
&lt;li&gt;render components on the server and only stream a serialized render tree to the client which support out of order rendering&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This allows application developers to use react to define alle components using react independent of them being rendert on the client or on the server. This integrated environment reduces the complexity of modern apps and gives removes the redundance of duplicated business logic in backend and frontend.&lt;/p&gt;

&lt;h3&gt;
  
  
  What frameworks support RSC?
&lt;/h3&gt;

&lt;p&gt;As the react library is official still beta none of them should be seen as production ready:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://nextjs.org" rel="noopener noreferrer"&gt;Next.js v15&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://waku.gg" rel="noopener noreferrer"&gt;Waku&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://react-server.dev" rel="noopener noreferrer"&gt;react-server&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://redwoodjs.com/blog/rsc-now-in-redwoodjs" rel="noopener noreferrer"&gt;RedwoodJS v9&lt;/a&gt; - still in Development&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Currently only Next.js is somewhat usable for production. Their Version 15 is the 4th iteration on RSC which started late 2021 with Version 12.&lt;/p&gt;

&lt;p&gt;Beyond the listed framework, here are some more repositories with blueprints on building a RSC framework - use them if you want to learn more about the internals:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/nksaraf/vinxi" rel="noopener noreferrer"&gt;Vinxi&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/twofold-rsc/twofold" rel="noopener noreferrer"&gt;Twofold&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/bndkt/kotekan" rel="noopener noreferrer"&gt;Kotekan&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/rafaelrcamargo/r19" rel="noopener noreferrer"&gt;r19&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;If you know from more frameworks please provide links to them in the comments.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  What makes RSC hard to implement in frameworks?
&lt;/h3&gt;

&lt;p&gt;Transcribing and bundling, based on the great existing bundlers of a react client app is simple. There are multiple options to do this and one of the most used one is by using ViteJs as the development server and bundler. Frameworks which provided a JavaScript frontend and backend stack still had to provide their own solution to handle typescript and bundling in development and for production.&lt;/p&gt;

&lt;p&gt;With RSC a bundler needs to handle a minimum of three transcribe and bundle pipelines:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Browser Client&lt;/li&gt;
&lt;li&gt;SSR Server&lt;/li&gt;
&lt;li&gt;RSC Component renderer and sterilization api&lt;/li&gt;
&lt;li&gt;optional middleware&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Until the release of Vite version 6 this needed a lot of special code to provide a working solution. Next.js just switch to Turbopack in version 15 to fix the laggings they got based on the complexity and the use of webpack which was never build to handle this kind of problems.&lt;br&gt;
&lt;a href="https://vite.dev/blog/announcing-vite6.html" rel="noopener noreferrer"&gt;Vite 6&lt;/a&gt; new features are many targeting framework authors and provide a great solution with their new &lt;a href="https://vite.dev/guide/api-environment" rel="noopener noreferrer"&gt;environmental api&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Based on the fact that now components are rendered in completely different environment, each react library need to be built to handle the restrictions of each of these environments by providing alternative content. Currently most libraries can handle being rendered on the server to create SSR content, where many browsers specific APIs are missing. Rendering RSC components brings an additional limitation with a different react server library which for example do not support react context and state and break libraries which need this to provide theming to all child components. And libraries need a proper export option in packages.json and ESM-Modules for the library and all related sub libraries.&lt;/p&gt;

&lt;p&gt;The second piece not provided by the react library for RSC is the router. Without a router which handles client and server routing, react server component do not know which state to render on the server. This is the reason why each of the framework comes with their own implementation of a router and until the api for this gets standardized, server and clients components developed for one framework will need to be changed to work with another framework.&lt;/p&gt;
&lt;h3&gt;
  
  
  All requirements for a true RSC framework
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;React Server Components

&lt;ul&gt;
&lt;li&gt;Server Components without a Server&lt;/li&gt;
&lt;li&gt;Server Components with a Server&lt;/li&gt;
&lt;li&gt;Async components with Server Components&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Server Actions

&lt;ul&gt;
&lt;li&gt;Creating a Server Action from a Server Component&lt;/li&gt;
&lt;li&gt;Importing Server Actions from Client Components&lt;/li&gt;
&lt;li&gt;Composing Server Actions with Actions&lt;/li&gt;
&lt;li&gt;Form Actions with Server Actions&lt;/li&gt;
&lt;li&gt;Server Actions with useActionState&lt;/li&gt;
&lt;li&gt;Progressive enhancement with useActionState&lt;/li&gt;
&lt;li&gt;Single Request to Server with updated data for the UI in the response&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Directives

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;'use client'&lt;/code&gt; lets you mark what code runs on the client.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;'use server'&lt;/code&gt; marks server-side functions that can be called from client-side code.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;bundling for all three targets in DEV and PROD&lt;/li&gt;
&lt;li&gt;clientside routing api&lt;/li&gt;
&lt;li&gt;serverside routing api&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;more details on React Server Components can be found in the &lt;a href="https://react.dev/reference/rsc/server-components" rel="noopener noreferrer"&gt;official React documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Optional Requirements for meta-frameworks:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Server-side Rendering (SSR)&lt;/li&gt;
&lt;li&gt;Static Site Generation (SSG)&lt;/li&gt;
&lt;li&gt;Nested Layouts&lt;/li&gt;
&lt;li&gt;Streaming&lt;/li&gt;
&lt;li&gt;Filesystem router&lt;/li&gt;
&lt;li&gt;none-React API endpoints&lt;/li&gt;
&lt;li&gt;Middleware&lt;/li&gt;
&lt;li&gt;Multiple deployment targets&lt;/li&gt;
&lt;li&gt;Support for Edge-Runtimes (AWS Lambda@Edge, Cloudflare)&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  &lt;a href="https://nextjs.org" rel="noopener noreferrer"&gt;Next.js&lt;/a&gt; - why look for alternative options?
&lt;/h2&gt;

&lt;p&gt;Based on the fact, that Next.js 15 is the most majored RSC framework, why should I have a need to look at alternative frameworks?&lt;/p&gt;

&lt;p&gt;The reasons to do this are always based on the goal to reach, but I will try to list some reasons why it makes sense to look at the other options:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Next.js is complex framework which tries to cover many different use cases which might not be relevant for the given project&lt;/li&gt;
&lt;li&gt;based on the complexity and usage of all provided features, the deployment to other cloud environments beside Vercel are not official supported and require some huge effort to stay in sync with the changes happening to this hosting requirements with each minor and major versions.&lt;/li&gt;
&lt;li&gt;until Version 15, which changes the bundler to Turbopack, development experience was slow and sluggish&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Please keep in mind, that this article only focuses on alternatives which provide RSC, but there are many more frameworks which provide nearly similar features to RSC and could be much better alternatives than the RSC frameworks listed in this article.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h2&gt;
  
  
  &lt;a href="https://waku.gg" rel="noopener noreferrer"&gt;Waku&lt;/a&gt; - The minimal React Framework
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Developed by &lt;a href="https://dev.to/dai_shi"&gt;Daishi Kato&lt;/a&gt;:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Waku (wah-ku) or わく means “framework” in Japanese. As the minimal React framework, it’s designed to accelerate the work of developers at startups and agencies building small to medium-sized React projects. These include marketing websites, light ecommerce, and web applications.&lt;/p&gt;

&lt;p&gt;We recommend other frameworks for heavy ecommerce or enterprise applications. Waku is a lightweight alternative bringing a fun developer experience to the server components era. Yes, let’s make React development fun again!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Starting a new project with &lt;code&gt;Waku&lt;/code&gt; is simple and you will get a starter template which is setup with tailwind:&lt;br&gt;
&lt;code&gt;npm create waku@latest&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;All base requirements are covered &lt;strong&gt;including returning updates to client side components in a single request&lt;/strong&gt; when using mutating server actions.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftm5ezwfc6tob1u7flxsk.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftm5ezwfc6tob1u7flxsk.gif" alt="Waku single request mutation and ui update" width="764" height="350"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The following optional requirements are still in development:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Nested Filesystem Routes&lt;/li&gt;
&lt;li&gt;none-React API endpoints&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Supports many deployment targets: Vercel, Netlify, Cloudflare, PartyKit, Deno, AWS Lambda, NodeJS&lt;/p&gt;

&lt;p&gt;Based on the complexity of bundling be prepared to have problems with a lot of third-party libraries:&lt;br&gt;
&lt;a href="https://github.com/dai-shi/waku/issues/423" rel="noopener noreferrer"&gt;https://github.com/dai-shi/waku/issues/423&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  &lt;a href="https://react-server.dev" rel="noopener noreferrer"&gt;@lazarv/react-server&lt;/a&gt; - The easiest way to build React apps with server-side rendering
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Developed by &lt;a href="https://dev.to/lazarv"&gt;Viktor Lázár&lt;/a&gt;:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I created &lt;a class="mentioned-user" href="https://dev.to/lazarv"&gt;@lazarv&lt;/a&gt;/react-server because I wanted to use React Server Components and Server Actions using Vite ❤️. For most small apps Next.js was too much, too heavy and slow. I wanted to have the same experience as you run a simple JavaScript file using node.js. This framework is trying to be non-opinionated as much as possible. You can achieve possibly anything you want. The only restriction is that it will use it's own React version. You don't even need to install React in your project. It's all included in the framework. I hope you will enjoy using this framework as much as I enjoyed creating it and using it to create this documentation too. - lazarv&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Learning react server components is a breeze with this framework! A single file with a valid react server component and running the command is all you need:&lt;/p&gt;

&lt;p&gt;./App.jsx&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hello, World!&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx @lazarv/react-server ./App.jsx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is a good documentation on how to &lt;a href="https://react-server.dev/guide/get-started" rel="noopener noreferrer"&gt;get started&lt;/a&gt; and a couple of example projects in the &lt;a href="https://react-server.dev/tutorials" rel="noopener noreferrer"&gt;tutorial section&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;All base requirements are covered including returning updates to client side components in a single request when using mutating server actions.&lt;/p&gt;

&lt;p&gt;As the runtime depends on NodeJS APIs, other runtimes e.g. (AWS Lambda@Edge, Cloudflare) are currently not supported.&lt;/p&gt;

&lt;p&gt;Additionally the following feature exist:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Access HTTP context in server components and actions&lt;/li&gt;
&lt;li&gt;Caching any server data and server response with revalidation based on key ord tags&lt;/li&gt;
&lt;li&gt;Error handling&lt;/li&gt;
&lt;li&gt;Partial pre-rendering - define parts of a JSX page as static shell&lt;/li&gt;
&lt;li&gt;NodeJS Cluster mode&lt;/li&gt;
&lt;li&gt;Micro-frontends - split your application into smaller, more manageable pieces. Use the RemoteComponent component to load a micro-frontend from a remote URL and render it in your application using server-side rendering&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Deployment targets: NodeJS, Vercel - Adapters in Development: Netlify, Cloudflare, sst&lt;/p&gt;

&lt;p&gt;Supports out of the box Tailwind CSS, TanStack Query, Mantine UI, Material UI.&lt;/p&gt;



&lt;h2&gt;
  
  
  &lt;a href="https://redwoodjs.com" rel="noopener noreferrer"&gt;RedwoodJS&lt;/a&gt; - The Single-Dev Framework that Just Works
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Provided by Tom Preston-Werner:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Redwood is the full-stack JavaScript application framework.&lt;br&gt;
Batteries, backend, React, conventions, and opinions included.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Still in development&lt;/strong&gt; and only works with Node v20 and Yarn 4:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx &lt;span class="nt"&gt;-y&lt;/span&gt; create-redwood-app@canary &lt;span class="nt"&gt;-y&lt;/span&gt; ~/rsc_app
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/rsc_app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You’ll then need to enable a couple of experimental features:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn rw experimental setup-streaming-ssr &lt;span class="nt"&gt;-f&lt;/span&gt;
yarn rw experimental setup-rsc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, build and serve:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn rw build
yarn rw serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As part of the setup-rsc command a barebones RSC app is created for you, demonstrating a client component rendering inside of a server component&lt;/p&gt;

&lt;p&gt;Deployment targets: Vercel, Netlify, Render, GCP or AWS via Coherence, AWS via Flightcontrol, NodeJS&lt;/p&gt;



&lt;h2&gt;
  
  
  Comparison: Next.js vs. Alternatives
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Next.js&lt;/th&gt;
&lt;th&gt;WAKU&lt;/th&gt;
&lt;th&gt;React-server&lt;/th&gt;
&lt;th&gt;RedwoodJS&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;DEV-Environment / Bundling&lt;/td&gt;
&lt;td&gt;Turbopack&lt;/td&gt;
&lt;td&gt;Vite 5&lt;/td&gt;
&lt;td&gt;Vite 6&lt;/td&gt;
&lt;td&gt;Vite&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rendering&lt;/td&gt;
&lt;td&gt;SSR, ISR, SSG, CSR&lt;/td&gt;
&lt;td&gt;SSR, SSG, CSR&lt;/td&gt;
&lt;td&gt;SSR, SSG, CSR, Micro-Frontends&lt;/td&gt;
&lt;td&gt;SSR, SSG, CSR&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Caching Layers&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;??&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Deployment Target&lt;/td&gt;
&lt;td&gt;Vercel, NodeJS&lt;/td&gt;
&lt;td&gt;Vercel, Netlify, Cloudflare, Deno, AWS Lambda, PartyKit, NodeJS&lt;/td&gt;
&lt;td&gt;Vercel, NodeJS, sst (AWS Lambda)&lt;/td&gt;
&lt;td&gt;Vercel, Netlify, AWS, NodeJS&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Community&lt;/td&gt;
&lt;td&gt;Very Big&lt;/td&gt;
&lt;td&gt;Tiny&lt;/td&gt;
&lt;td&gt;Just Starting&lt;/td&gt;
&lt;td&gt;Small&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Open Source Financing&lt;/td&gt;
&lt;td&gt;Vercel&lt;/td&gt;
&lt;td&gt;Donations&lt;/td&gt;
&lt;td&gt;Donations&lt;/td&gt;
&lt;td&gt;Privately Funded by a Rich Guy&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Recap of Key Takeaways:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;RSC provides a powerful paradigm for modern web development.&lt;/li&gt;
&lt;li&gt;Next.js is excellent but not the only choice.&lt;/li&gt;
&lt;li&gt;Alternatives offer diverse capabilities for different needs but miss the single request mutation UI updates.&lt;/li&gt;
&lt;li&gt;Libraries in the React Ecosystem are still not ready to embrace RSC&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Try out frameworks to find the best fit for your project.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>react</category>
      <category>waku</category>
      <category>rsc</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Howto handle index key specification without a key length and key was too long</title>
      <dc:creator>AndreasHeissenberger</dc:creator>
      <pubDate>Fri, 03 Jun 2022 09:48:18 +0000</pubDate>
      <link>https://dev.to/aheissenberger/howto-handle-index-key-specification-without-a-key-length-and-key-was-too-long-3k56</link>
      <guid>https://dev.to/aheissenberger/howto-handle-index-key-specification-without-a-key-length-and-key-was-too-long-3k56</guid>
      <description>&lt;p&gt;You create your datastructure and define a table which will allow UPSERT (insert if document not exists) and get one of this errors:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;1170 BLOB/TEXT column 'document_id' used in key specification without a key length&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Specified key was too long; max key length is 3072 bytes&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  The Problem
&lt;/h4&gt;

&lt;p&gt;When creating an index there is an impelementation specific limit on the maximum number of bytes allowd per key. &lt;br&gt;
It is bytes and not characters as it depends on the defined charset of the collation how many bytes are needed per character.&lt;/p&gt;

&lt;p&gt;Here is a sample table which is uses the columns &lt;code&gt;collection&lt;/code&gt; and &lt;code&gt;document_id&lt;/code&gt; for the primary key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;type_varchar&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nv"&gt;`collection`&lt;/span&gt; &lt;span class="nb"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;COLLATE&lt;/span&gt; &lt;span class="n"&gt;utf8mb3_unicode_ci&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nv"&gt;`document_id`&lt;/span&gt; &lt;span class="nb"&gt;varchar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;COLLATE&lt;/span&gt; &lt;span class="n"&gt;utf8mb3_unicode_ci&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nv"&gt;`document_type`&lt;/span&gt; &lt;span class="nb"&gt;longtext&lt;/span&gt; &lt;span class="k"&gt;COLLATE&lt;/span&gt; &lt;span class="n"&gt;utf8mb3_unicode_ci&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nv"&gt;`document`&lt;/span&gt; &lt;span class="nb"&gt;longtext&lt;/span&gt; &lt;span class="k"&gt;COLLATE&lt;/span&gt; &lt;span class="n"&gt;utf8mb3_unicode_ci&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;COMMENT&lt;/span&gt; &lt;span class="s1"&gt;'(DC2Type:json)'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;document_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;ENGINE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;InnoDB&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="n"&gt;CHARSET&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;utf8mb3&lt;/span&gt; &lt;span class="k"&gt;COLLATE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;utf8mb3_unicode_ci&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result of this will be this error:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SQLSTATE[42000]: Syntax error or access violation: 1170 BLOB/TEXT column 'document_id' used in key specification without a key length&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Some people or sources on the web will tell you that you should not use BLOB/TEXT for the index and suggest to use VARCHAR:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;type_varchar&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nv"&gt;`collection`&lt;/span&gt; &lt;span class="nb"&gt;varchar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;800&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;COLLATE&lt;/span&gt; &lt;span class="n"&gt;utf8mb3_unicode_ci&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nv"&gt;`document_id`&lt;/span&gt; &lt;span class="nb"&gt;varchar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;COLLATE&lt;/span&gt; &lt;span class="n"&gt;utf8mb3_unicode_ci&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nv"&gt;`document_type`&lt;/span&gt; &lt;span class="nb"&gt;longtext&lt;/span&gt; &lt;span class="k"&gt;COLLATE&lt;/span&gt; &lt;span class="n"&gt;utf8mb3_unicode_ci&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nv"&gt;`document`&lt;/span&gt; &lt;span class="nb"&gt;longtext&lt;/span&gt; &lt;span class="k"&gt;COLLATE&lt;/span&gt; &lt;span class="n"&gt;utf8mb3_unicode_ci&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;COMMENT&lt;/span&gt; &lt;span class="s1"&gt;'(DC2Type:json)'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;document_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;ENGINE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;InnoDB&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="n"&gt;CHARSET&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;utf8mb3&lt;/span&gt; &lt;span class="k"&gt;COLLATE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;utf8mb3_unicode_ci&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result of this will be this error:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SQLSTATE[42000]: Syntax error or access violation: Specified key was too long; max key length is 3072 bytes&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  How To Fix?
&lt;/h4&gt;

&lt;p&gt;Fixing both errors only requires to add a length value of &lt;code&gt;(768)&lt;/code&gt; to the column specified in the primary key:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;PRIMARY KEY (collection(768),document_id)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;But how do you calulate the value for the length?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;get your collection charset &lt;code&gt;COLLATE utf8mb3_unicode_ci&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;lookup the bytes for the charaterset &lt;code&gt;utf8mb3&lt;/code&gt; or the alias &lt;code&gt;utf8&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;utf8mb3:&lt;/strong&gt; 3 bytes&lt;/p&gt;

&lt;p&gt;Based on the 2. error, a maximum of 3072 bytes is allowed per column by the database engine (MySQL / MariaDB):&lt;br&gt;
&lt;code&gt;3072 / 3 = 1024&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;On my MariaDB 10.8.3 instance this fails as it looks like that the index is using &lt;code&gt;utf8mb4&lt;/code&gt; a 4 byte collation &lt;code&gt;3072 / 4 = 768&lt;/code&gt; which works! &lt;/p&gt;
&lt;/blockquote&gt;
&lt;h4&gt;
  
  
  Difference between TEXT and VARCHAR
&lt;/h4&gt;

&lt;p&gt;On a first look both support up to 65,535 bytes and only need the space used by real data but MySQL imposes a limit of 65,535 bytes for the max size of each row. &lt;br&gt;
The size of a VARCHAR column is counted towards the maximum row size, while TEXT columns are assumed to be storing their data by reference so they only need 9-12 bytes. &lt;br&gt;
That means even if the "theoretical" max size of your VARCHAR field is 65,535 characters you won't be able to achieve that if you have more than one column in your table.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TEXT&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;fixed maximum of 65,535 bytes (no option to limit the size)&lt;/li&gt;
&lt;li&gt;needs &lt;code&gt;2+c&lt;/code&gt; bytes on disk, where c is the length of the bytes used by the string based on the charset&lt;/li&gt;
&lt;li&gt;no default value&lt;/li&gt;
&lt;li&gt;tempory tables will use a disk based table (MEMORY table does not support TEXT/BLOB)&lt;/li&gt;
&lt;li&gt;requires a defined maximum length of the part which becomes a key&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;VARCHAR(N)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;variable maximum size of &lt;code&gt;N&lt;/code&gt; bytes (charaters depend o)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;N&lt;/code&gt; is between 1 and 65,535 - &lt;a href="https://dba.stackexchange.com/questions/424/performance-implications-of-mysql-varchar-sizes/1915#1915"&gt;Performance implications / Stackexchange&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;takes 1 + &lt;code&gt;c&lt;/code&gt; bytes (for &lt;code&gt;N&lt;/code&gt; ≤ 255) or 2 + &lt;code&gt;c&lt;/code&gt; (for 256 ≤ &lt;code&gt;N&lt;/code&gt; ≤ 65535) bytes of disk space where &lt;code&gt;c&lt;/code&gt; is the length of the stored string&lt;/li&gt;
&lt;li&gt;part of a index works exept for &lt;code&gt;N&lt;/code&gt; &amp;gt; max key length which reqires to manually set the length of the key&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Some of the implementation details depend on the engine e.g. &lt;code&gt;InnoDB&lt;/code&gt; or &lt;code&gt;MyISAM&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Real content using &lt;code&gt;utf8mb4&lt;/code&gt; will use 2, 3 or 4 byted depending on the character!&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h4&gt;
  
  
  Fail Primary/Unique Keys with limited length?
&lt;/h4&gt;

&lt;p&gt;Does a shortend index key still provide a unique key to fullfill all requirements for a primary/unique key to not allow dupblicates?&lt;/p&gt;

&lt;p&gt;Test with a index key with length 1 - &lt;code&gt;collection(1)&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;type_varchar&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nv"&gt;`collection`&lt;/span&gt; &lt;span class="nb"&gt;varchar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;800&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;COLLATE&lt;/span&gt; &lt;span class="n"&gt;utf8mb3_unicode_ci&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nv"&gt;`document_id`&lt;/span&gt; &lt;span class="nb"&gt;varchar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;COLLATE&lt;/span&gt; &lt;span class="n"&gt;utf8mb3_unicode_ci&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nv"&gt;`document_type`&lt;/span&gt; &lt;span class="nb"&gt;longtext&lt;/span&gt; &lt;span class="k"&gt;COLLATE&lt;/span&gt; &lt;span class="n"&gt;utf8mb3_unicode_ci&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nv"&gt;`document`&lt;/span&gt; &lt;span class="nb"&gt;longtext&lt;/span&gt; &lt;span class="k"&gt;COLLATE&lt;/span&gt; &lt;span class="n"&gt;utf8mb3_unicode_ci&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;COMMENT&lt;/span&gt; &lt;span class="s1"&gt;'(DC2Type:json)'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="n"&gt;document_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;ENGINE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;InnoDB&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="n"&gt;CHARSET&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;utf8mb3&lt;/span&gt; &lt;span class="k"&gt;COLLATE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;utf8mb3_unicode_ci&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;insert two times the same content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INSERT INTO `type_varchar` (`collection`, `document_id`, `document_type`, `document`)
VALUES
    (REPEAT('1',800), '1', 't1', 'doc1');
INSERT INTO `type_varchar` (`collection`, `document_id`, `document_type`, `document`)
VALUES
    (REPEAT('1',800), '1', 't1', 'doc1');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;the result is the expected error:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Duplicate entry '1111111111111111111111111111111111111111111111111111111111111...' for key 'PRIMARY'&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;PRIMARY KEY or UNIQUE KEY with limited length are &lt;strong&gt;valid unique indexes&lt;/strong&gt;!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;What are the implications:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;performance will suffer as there will be a need to scan the table&lt;/li&gt;
&lt;li&gt;size of index will be very small&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>sql</category>
      <category>mysql</category>
      <category>database</category>
    </item>
    <item>
      <title>Docker Desktop - should I pay?</title>
      <dc:creator>AndreasHeissenberger</dc:creator>
      <pubDate>Mon, 13 Sep 2021 11:40:40 +0000</pubDate>
      <link>https://dev.to/aheissenberger/docker-desktop-should-i-pay-3kdi</link>
      <guid>https://dev.to/aheissenberger/docker-desktop-should-i-pay-3kdi</guid>
      <description>&lt;h4&gt;
  
  
  Executive Summery
&lt;/h4&gt;

&lt;p&gt;You are &lt;strong&gt;not required to subscribe to a payed license&lt;/strong&gt; if your company has fewer than 250 employees and less than $10 million annual revenue - stop reading now! For anyone who needs to argument why it is worth to pay or is willing to invest in alternatives will find some information or read the great &lt;a href="https://www.docker.com/pricing/faq/"&gt;FAQs&lt;/a&gt; provided by Docker.&lt;/p&gt;

&lt;h3&gt;
  
  
  History
&lt;/h3&gt;

&lt;p&gt;Docker is the result of a startup during the Y Combinator Summer 2010 and was not open-sourced until March 2013.&lt;/p&gt;

&lt;p&gt;My own involvement started 2014 when a group of people outside docker created a micro Linux distribution &lt;a href="https://github.com/boot2docker/boot2docker"&gt;boot2docker&lt;/a&gt; to provide a better integration of docker on MacOS. &lt;/p&gt;

&lt;p&gt;At that time I have been using different kind of virtual machines to manage different development environment but with the addition of handling multiple PHP and NodeJS version it became really difficult to keep all this environment up to date. &lt;/p&gt;

&lt;p&gt;With docker containers, the documented way to replicate complex production setups locally made me do the switch and up to now this is still my favoured feature!&lt;/p&gt;

&lt;p&gt;boot2docker provided a Bash based wrapper which allowed simplified handling for the creation of the &lt;a href="https://www.virtualbox.org"&gt;VM VirtualBox&lt;/a&gt; to run the docker daemon. I learned a lot about the complexity by fixing bugs and extending the existing functionality of the wrapper. Based on the popularity of the tool in the MacOS commuity Docker Inc added &lt;a href="https://github.com/SvenDowideit"&gt;Sven Dowideit&lt;/a&gt; from their team to this project and I became a maintainer on the project. Based on the move inside docker to rewrite everything in docker, I also helped porting the existing bash-cli wrapper to golang &lt;a href="https://github.com/boot2docker/boot2docker-cli"&gt;boot2docker-cli&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I invested roughly 2 month of unpaid work into these projects to make them suitable to my needs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The release of the first stable release of &lt;a href="https://docs.docker.com/desktop/mac/previous-versions/#docker-for-mac-1120-2016-07-28"&gt;Docker for Mac&lt;/a&gt; June 2016 made a huge different. From know on there was a simple install process to handle the installation of all the tools (e.g. docker-cli, docker-machine, docker-compose) and a regular patched Linux distro with an up to date docker engine. No more lost or broken data containers and a much easier handling of binding and sharing the file system. &lt;/p&gt;

&lt;p&gt;Only a couple of month later, Sept. 2016 the dedicated team at docker replaced the VM still based on &lt;a href="https://www.virtualbox.org"&gt;VirtualBox&lt;/a&gt; with the first HyperKit implementation.&lt;/p&gt;

&lt;p&gt;If you look at the release pages of &lt;a href="https://docs.docker.com/desktop/mac/previous-versions/#stable-releases-of-2016"&gt;Docker for Mac&lt;/a&gt; and &lt;a href="https://docs.docker.com/desktop/mac/release-notes/"&gt;Docker Desktop&lt;/a&gt; you can see how much work has been done since 2016 and where the value is which is not so easy to replicate. All information on history is provided by &lt;a href="https://en.wikipedia.org/wiki/Docker_(software)"&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use Cases
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;There are many use cases supported by docker:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Local Development Setup&lt;/li&gt;
&lt;li&gt;Local Server simulation&lt;/li&gt;
&lt;li&gt;Complex Application Setup&lt;/li&gt;
&lt;li&gt;Legacy Application&lt;/li&gt;
&lt;li&gt;Kubernetes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and there are many more.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The use case which is target by &lt;strong&gt;Docker Desktop&lt;/strong&gt; is &lt;em&gt;local development&lt;/em&gt; and this is where it shines. Many of the alternative options will not provide you with a similar smooth experience starting with first time installation and later regular updates.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you still think you need an alternative the &lt;a href="https://share.transistor.fm/s/b42e9465"&gt;Docker'S New Licensing Changes Podcast&lt;/a&gt; by Bret Fisher  discusses many other question related to licensing and alternative options but none matches the features provided by Docker Desktop. &lt;br&gt;
The website of the Episode will list some links to other blog posts which might provide you with insides on how to install alternative options and the complexity of this kind of solution.&lt;/p&gt;

&lt;h3&gt;
  
  
  Arguments for Docker Desktop
&lt;/h3&gt;

&lt;p&gt;Most of this arguments are valid for single developers and a company with many developers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Installer providing 

&lt;ul&gt;
&lt;li&gt;LinuxKit mini VM on HyperKit (MacOS) or Host + WSL2 VM support (Windows)&lt;/li&gt;
&lt;li&gt;Integration with OS to share ports &lt;/li&gt;
&lt;li&gt;Local Bind mount file system&lt;/li&gt;
&lt;li&gt;Volume mounts (osxfs, ntfs)&lt;/li&gt;
&lt;li&gt;GUI to setup VM and docker engine&lt;/li&gt;
&lt;li&gt;VPNKit for handling client VPN connections&lt;/li&gt;
&lt;li&gt;docker engine, docker client, docker compose,...&lt;/li&gt;
&lt;li&gt;Secret storage based on OS mechanism&lt;/li&gt;
&lt;li&gt;macOS Apple Silicon (M1) support&lt;/li&gt;
&lt;li&gt;ssh-agent forwarding&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;GUI providing autom. updates of all tools&lt;/li&gt;
&lt;li&gt;Tested integrations with VS Code and many other tools&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you look at the alternatives you will quickly see that you need an extra patch to get some stuff work with the MacOS M1 chip (&lt;a href="https://github.com/lima-vm/lima#getting-started"&gt;Lima manual install steps for ARM Mac&lt;/a&gt;) and even there are installers based on the excellent  &lt;a href="https://brew.sh"&gt;Homebrew&lt;/a&gt; package manger there is no guarantee that a full setup of different tools will not break after a simple update.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If Docker Desktop is a tool you use on a daily base for your work think twice and if you are honest to yourself or to your managers you can provide more to your company by doing work and not fixing tools.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you still not convinced please plan the additional time you will spend on setup and maintenance.&lt;/p&gt;

</description>
      <category>docker</category>
      <category>macos</category>
      <category>windows</category>
      <category>devops</category>
    </item>
    <item>
      <title>Docker compose up build fails to update container</title>
      <dc:creator>AndreasHeissenberger</dc:creator>
      <pubDate>Fri, 28 May 2021 10:16:49 +0000</pubDate>
      <link>https://dev.to/aheissenberger/docker-compose-up-build-fails-to-update-container-2pid</link>
      <guid>https://dev.to/aheissenberger/docker-compose-up-build-fails-to-update-container-2pid</guid>
      <description>&lt;p&gt;if you try the following command to &lt;strong&gt;update your service after changes&lt;/strong&gt; and it works for you with some projects but &lt;strong&gt;not with all projects&lt;/strong&gt; I can help you to fix the problem and understand the reason behind this behaviour:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose &lt;span class="nt"&gt;-f&lt;/span&gt; docker-compose.prod.yml up &lt;span class="nt"&gt;--build&lt;/span&gt; &lt;span class="nt"&gt;--no-deps&lt;/span&gt; &lt;span class="nt"&gt;--detach&lt;/span&gt; your_service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's explain what this command is requested to do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;up&lt;/code&gt; start the service &lt;code&gt;your_service&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--build&lt;/code&gt; build the image if it does not exist or has changed. Use cache for parts which have not changed.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--no-deps&lt;/code&gt; do not start any linked services&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--detach&lt;/code&gt; run container in background
&lt;em&gt;(official documentation &lt;a href="https://docs.docker.com/compose/reference/up/"&gt;docker-compose up&lt;/a&gt;)&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What we expect after we changed files which are part of the image:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;rebuild of the image&lt;/li&gt;
&lt;li&gt;using the cache to avoid rebuild of parts which have not changed&lt;/li&gt;
&lt;li&gt;restart of the container based on the new image&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are many places on the web which suggest this command and for it only worked with some of my projects. Digging into the problem I found out that the reason behind are &lt;strong&gt;anonymous volumes&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;To fix the problem with &lt;strong&gt;anonymous volumes&lt;/strong&gt; you only need to add &lt;code&gt;--renew-anon-volumes&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose &lt;span class="nt"&gt;-f&lt;/span&gt; docker-compose.prod.yml up &lt;span class="nt"&gt;--build&lt;/span&gt; &lt;span class="nt"&gt;--no-deps&lt;/span&gt; &lt;span class="nt"&gt;--renew-anon-volumes&lt;/span&gt; &lt;span class="nt"&gt;--detach&lt;/span&gt; your_service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The additional flag will allway recreate all anonymous volumes on the restart for this service. This will make any changes overlapping with these volumes to become visible.&lt;/p&gt;

&lt;p&gt;There is an other option called &lt;code&gt;--force-recreate&lt;/code&gt; which suggest to be the solution but will not solve the problem with the anonymous volumes mapping over your changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's behind anonymous volumes
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Check for existing anon volumes
&lt;/h3&gt;

&lt;p&gt;Use this command and replace &lt;code&gt;&amp;lt;your container id&amp;gt;&lt;/code&gt; with your container ID:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker inspect &lt;span class="nt"&gt;--type&lt;/span&gt; container &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="s1"&gt;'{{range $i, $v := .Mounts }}{{printf "%v\n" $v}}{{end}}'&lt;/span&gt; &amp;lt;your container &lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;all anonymous volumes will have a long internal hash directly after &lt;code&gt;{volume&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{volume 277654df19e38eeb10f92be90c8df76558033bcd3c7b871e75abdc14174a46d8 /var/lib/docker/volumes/277654df19e38eeb10f92be90c8df76558033bcd3c7b871e75abdc14174a46d8/_data /opt/app/etc local  true }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  How do I create such a volume?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;A) docker-compose.yml&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;your_service&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
     &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;.&lt;/span&gt;
     &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
       &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;/my_data&lt;/span&gt; &lt;span class="c1"&gt;# anonymous volume&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;B) Dockerfile&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;VOLUME&lt;/span&gt;&lt;span class="s"&gt;  "/var/logs" "/data"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's asume that we normally only use named volumes and no  anonymous volumes in our &lt;code&gt;docker-compose.yml&lt;/code&gt; files and focus on option B).&lt;/p&gt;

&lt;p&gt;If we look at the official  documentation for &lt;a href="https://docs.docker.com/engine/reference/builder/#volume"&gt;VOLUME&lt;/a&gt; we will not find any clues:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The&lt;code&gt;VOLUME&lt;/code&gt;instruction creates a mount point with the specified name and marks it as holding externally mounted volumes from native host or other containers. The…&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To explain the details we need an example which simulates the problem.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src
  config
    name.txt
  hello-world.sh
  Dockerfile
docker-compose.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can clone these files from this repository:&lt;br&gt;
&lt;a href="https://github.com/aheissenberger/docker-anon-volumes"&gt;https://github.com/aheissenberger/docker-anon-volumes&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;src/hello-world.sh&lt;/strong&gt; - our service app&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/sh&lt;/span&gt;
&lt;span class="nv"&gt;NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; /app/config/name.txt&lt;span class="si"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="nb"&gt;sleep &lt;/span&gt;5&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;  &lt;span class="s2"&gt;"Hello World! Hello &lt;/span&gt;&lt;span class="nv"&gt;$NAME&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;src/config/name.txt&lt;/strong&gt; - a config file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Max
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;src/Dockerfile&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt;  alpine&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt;  hello-world.sh  /app/hello-world.sh&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt;  config/name.txt  /app/config/name.txt&lt;/span&gt;
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt;  \["sh","/app/hello-world.sh"\]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;docker-compose.yml&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;hello&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;./src&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;we can start the service:&lt;br&gt;
&lt;code&gt;docker compose up --detach&lt;/code&gt;&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Hint:&lt;/strong&gt; if you do not have the latest version of docker, you will have to replace &lt;code&gt;docker compose&lt;/code&gt; with &lt;code&gt;docker-compose&lt;/code&gt; with the dash between the words!&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Creating network "docker-anon-volumes_default" with the default driver
Building hello
[+] Building 2.0s (8/8) FINISHED                                                           
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
WARNING: Image for service hello was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
Creating docker-anon-volumes_hello_1 ... done
Attaching to docker-anon-volumes_hello_1
hello_1  | Hello World! Hello Max
hello_1  | Hello World! Hello Max
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;check the output of the service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;docker compose logs &lt;span class="nt"&gt;-f&lt;/span&gt;
hello_1  | Hello World! Hello Max
hello_1  | Hello World! Hello Max
hello_1  | Hello World! Hello Max
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;now we change the content in file &lt;code&gt;src/config/name.txt&lt;/code&gt; from &lt;code&gt;Max&lt;/code&gt; to &lt;code&gt;Rudi&lt;/code&gt;&lt;br&gt;
&lt;code&gt;echo "Rudi"&amp;gt;src/config/name.txt&lt;/code&gt; &lt;br&gt;
and restart the service with the new configuration&lt;br&gt;
&lt;code&gt;docker compose up --build --no-deps --detach&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;check the output of the service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;docker compose logs &lt;span class="nt"&gt;-f&lt;/span&gt;
hello_1  | Hello World! Hello Rudi
hello_1  | Hello World! Hello Rudi
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Exactly what we expected.&lt;/p&gt;

&lt;p&gt;Check for anonymous volumes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;get the ID of the container&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;docker ps        
CONTAINER ID   IMAGE          COMMAND                  CREATED          STATUS          PORTS     NAMES
1df0f6ee87d4   1c356deb72b1   &lt;span class="s2"&gt;"sh /app/hello-world…"&lt;/span&gt;   40 seconds ago   Up 37 seconds             docker-anon-volumes_hello_1
&lt;/code&gt;&lt;/pre&gt;


&lt;ol&gt;
&lt;li&gt;run the command to list the volumes with your container id &lt;code&gt;1df0f6ee87d4&lt;/code&gt; from &lt;code&gt;docker ps&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;docker inspect &lt;span class="nt"&gt;--type&lt;/span&gt; container &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="s1"&gt;'{{range $i, $v := .Mounts }}{{printf "%v\n" $v}}{{end}}'&lt;/span&gt; 1df0f6ee87d4
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;There should be no output by this command!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now we change our &lt;code&gt;Dockerfile&lt;/code&gt; to &lt;strong&gt;optional&lt;/strong&gt; allow to bind the &lt;code&gt;app/config&lt;/code&gt; directory to a local directory for development by adding the &lt;code&gt;VOLUME&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;src/Dockerfile&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt;  alpine&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt;  hello-world.sh  /app/hello-world.sh&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt;  config/name.txt  /app/config/name.txt&lt;/span&gt;
&lt;span class="k"&gt;VOLUME&lt;/span&gt;&lt;span class="s"&gt; /app/config&lt;/span&gt;
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt;  \["sh","/app/hello-world.sh"\]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;restart the service with the new configuration&lt;br&gt;
&lt;code&gt;docker compose up --build --no-deps --detach&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;check the output of the service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;docker compose logs &lt;span class="nt"&gt;-f&lt;/span&gt;
hello_1  | Hello World! Hello Rudi
hello_1  | Hello World! Hello Rudi
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;now we change the content in file &lt;code&gt;src/config/name.txt&lt;/code&gt; from &lt;code&gt;Rudi&lt;/code&gt; to &lt;code&gt;Franz&lt;/code&gt;&lt;br&gt;
&lt;code&gt;echo "Franz"&amp;gt;src/config/name.txt&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;restart the service with the new configuration&lt;br&gt;
&lt;code&gt;docker compose up --build --no-deps --detach&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;check the output of the service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;docker compose logs &lt;span class="nt"&gt;-f&lt;/span&gt;
hello_1  | Hello World! Hello Rudi
hello_1  | Hello World! Hello Rudi
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;This is not what we expected!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;We check for anonymous volumes:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;get the ID of the container&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;docker ps        
CONTAINER ID   IMAGE          COMMAND                  CREATED          STATUS          PORTS     NAMES
2419dd47277a   696b927fee44   &lt;span class="s2"&gt;"sh /app/hello-world…"&lt;/span&gt;   About a minute ago   Up About a minute             docker-anon-volumes_hello_1
&lt;/code&gt;&lt;/pre&gt;


&lt;ol&gt;
&lt;li&gt;run the command to list the volumes with your container id &lt;code&gt;2419dd47277a&lt;/code&gt; from &lt;code&gt;docker ps&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;docker inspect &lt;span class="nt"&gt;--type&lt;/span&gt; container &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="s1"&gt;'{{range $i, $v := .Mounts }}{{printf "%v\n" $v}}{{end}}'&lt;/span&gt; 2419dd47277a
&lt;span class="o"&gt;{&lt;/span&gt;volume c62baf7300ddc9dc66a7e871d6511e5e3a6274072cc20c3f14bb59bca5319935 /var/lib/docker/volumes/c62baf7300ddc9dc66a7e871d6511e5e3a6274072cc20c3f14bb59bca5319935/_data /app/config &lt;span class="nb"&gt;local &lt;/span&gt;rw &lt;span class="nb"&gt;true&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;What do we get:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;We have an anonymous volume attached to our container &lt;code&gt;volume c62baf7300ddc9dc66a7e871d6511e5e3a6274072cc20c3f14bb59bca5319935&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The container ID here &lt;code&gt;2419dd47277a&lt;/code&gt; is different to the one before &lt;code&gt;1df0f6ee87d4&lt;/code&gt;. This is a new container with the changes &lt;code&gt;name.txt&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The content of the anonymous volume is mapped to the &lt;code&gt;/app/config&lt;/code&gt; directory and is overlaying the new container with the old files&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Fixing
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;remove the &lt;code&gt;VOLUME&lt;/code&gt; command if not used&lt;/li&gt;
&lt;li&gt;add &lt;code&gt;--renew-anon-volumes&lt;/code&gt; to your &lt;code&gt;up --build&lt;/code&gt; to &lt;a href="https://docs.docker.com/compose/reference/up/"&gt;recreate this anonymous volume&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The number 1 reason why this happens is that you consume a third party image and you did never checked the exported VOLUMES of this image. As you are not in control of this image there is no way to fix this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let's try option 2):&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;change the content in file &lt;code&gt;src/config/name.txt&lt;/code&gt; from &lt;code&gt;Franz&lt;/code&gt;to &lt;code&gt;Hans&lt;/code&gt;&lt;br&gt;
&lt;code&gt;echo "Hans"&amp;gt;src/config/name.txt&lt;/code&gt;&lt;br&gt;
&lt;em&gt;we need to do this as the image has already created with name=Franz and a rebuild would not detect and changes what would lead to the up command not recreating the container and no recreation of the anonymous volumes&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose up &lt;span class="nt"&gt;--build&lt;/span&gt; &lt;span class="nt"&gt;--no-deps&lt;/span&gt; &lt;span class="nt"&gt;--detach&lt;/span&gt; &lt;span class="nt"&gt;--renew-anon-volumes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;check the output of the service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;docker compose logs &lt;span class="nt"&gt;-f&lt;/span&gt;
hello_1  | Hello World! Hello Hans
hello_1  | Hello World! Hello Hans
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is what we expected from the beginning :-)&lt;/p&gt;

</description>
      <category>docker</category>
    </item>
    <item>
      <title>Docker fails with OCI runtime create failed</title>
      <dc:creator>AndreasHeissenberger</dc:creator>
      <pubDate>Thu, 27 May 2021 10:45:06 +0000</pubDate>
      <link>https://dev.to/aheissenberger/docker-fails-with-oci-runtime-create-failed-4e3l</link>
      <guid>https://dev.to/aheissenberger/docker-fails-with-oci-runtime-create-failed-4e3l</guid>
      <description>&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;docker: Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: "/hello": stat /hello: no such file or directory: unknown.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;if you try the simples possible image and get this error you have found the information to solve your problem.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run hello-world
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete 
Digest: sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c
Status: Downloaded newer image for hello-world:latest
docker: Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: "/hello": stat /hello: no such file or directory: unknown.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;open &lt;code&gt;/etc/systemd/system/docker.service&lt;/code&gt; in your editor and remove &lt;code&gt;MountFlags=slave&lt;/code&gt; from the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[Service]
ExecStart=/usr/bin/docker daemon -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --storage-driver aufs --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-$
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
Environment=

...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;reload&lt;/strong&gt; the systemd configuration&lt;br&gt;
&lt;code&gt;systemctl daemon-reload&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;restart&lt;/strong&gt; docker&lt;br&gt;
&lt;code&gt;systemctl restart docker&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Test again with &lt;code&gt;docker run hello-world&lt;/code&gt; which should give you:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hello from Docker!
This message shows that your installation appears to be working correctly.
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Explaination
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;MountFlags=slave&lt;/code&gt; is no longer needed &lt;a href="https://docs.docker.com/engine/release-notes/18.09/#18091"&gt;Docker Release Notes 18.09.1&lt;/a&gt;&lt;/p&gt;

</description>
      <category>docker</category>
    </item>
  </channel>
</rss>
