<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Farihal Nimbergi on Medium]]></title>
        <description><![CDATA[Stories by Farihal Nimbergi on Medium]]></description>
        <link>https://medium.com/@farinim?source=rss-4928fa3b06a5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ns2Dsglmg-NpWvW1kShJ5g.jpeg</url>
            <title>Stories by Farihal Nimbergi on Medium</title>
            <link>https://medium.com/@farinim?source=rss-4928fa3b06a5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 03:48:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@farinim/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Setup Colima as container runtime and run test containers]]></title>
            <link>https://medium.com/@farinim/setup-colima-as-container-runtime-and-run-test-containers-157c972d63f0?source=rss-4928fa3b06a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/157c972d63f0</guid>
            <dc:creator><![CDATA[Farihal Nimbergi]]></dc:creator>
            <pubDate>Thu, 07 Nov 2024 18:29:01 GMT</pubDate>
            <atom:updated>2024-11-09T09:44:33.001Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://github.com/abiosoft/colima">Colima</a> is an open source alternate to <a href="https://www.docker.com/products/docker-desktop/">Docker Desktop</a>. On macOS linux containers are not natively supported, hence a VM is required. Docker Desktop, <a href="https://docs.rancherdesktop.io/">Rancher Desktop</a>, Colima are some tools that solve this problem. In this blog, we will consider Colima. It’s lightweight and very easy to install and use, with no licensing costs. I saw quite some questions on the web with Colima setup issues in context of test conatiner and that’s the main reason I wanted to write this blog. I am going to cover how to install and few tips on troubleshooting.</p><h3>Installation on Mac</h3><p>Before installing Colima, uninstall Docker Desktop.</p><p>Now go ahead and install Colima with simple brew command</p><pre>brew install colima</pre><p>If you don’t already have docker &amp; docker-compose, now is the time to set them up.</p><pre>brew install docker<br>brew install docker-compose</pre><p>We can now start colima</p><pre>colima start<br>INFO[0000] starting colima                              <br>INFO[0000] runtime: docker                              <br>INFO[0000] preparing network ...                         context=vm<br>INFO[0001] starting ...                                  context=vm<br>INFO[0013] provisioning ...                              context=docker<br>INFO[0014] starting ...                                  context=docker<br>INFO[0014] done          </pre><p>Verify colima status.</p><pre>colima status<br>INFO[0000] colima is running using QEMU                 <br>INFO[0000] arch: aarch64                                <br>INFO[0000] runtime: docker                              <br>INFO[0000] mountType: sshfs                             <br>INFO[0000] address:                                     <br>INFO[0000] socket: unix:///Users/xxx/.colima/default/docker.sock </pre><p>Now let us see whether the docker is running.</p><pre>docker ps<br>CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES</pre><p>So far so good. Let’s try to use Colima to run test containers.</p><h3>Setup test containers with Colima</h3><p>Open ~/.zshrc file and export below env varibales</p><pre>export DOCKER_HOST=&quot;unix://${HOME}/.colima/docker.sock&quot;<br>export TESTCONTAINERS_HOST_OVERRIDE=127.0.0.1<br>export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock<br>export TESTCONTAINERS_RYUK_DISABLED=true</pre><p>Restart the shell session with any of these commands:</p><pre>source ~./zshrc</pre><p>Or</p><pre>exec zsh -l</pre><p>You can now run your test containers. I only worked with java test containers. To run the tests from IntelliJ, connect to the docker daemon via Colima</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MewhSWVSXbYfCuD4ElBa0g.png" /></figure><p>You run this test like any other java test either through mvn test or just run in the IDE. The required docker images if not already present will be pulled, and container should be started and your test should just run fine.</p><h3>Troubleshooting</h3><p><strong>Issue# 1</strong></p><pre>java.net.UnknownHostException: xxx</pre><p>This is most like because the environment variable TESTCONTAINERS_HOST_OVERRIDE is not really setup correctly. Try echoing its value to see what address it points to and ensure it&#39;s a valid one.</p><p>In my case I was trying to set it dynamically with below expression which was broken.</p><pre>export TESTCONTAINERS_HOST_OVERRIDE=$(colima ls -j | jq -r &#39;.address&#39;)</pre><p>I manually set it to a fix value and it worked like a charm.</p><p><strong>Issue#2</strong></p><p>I faced issues with <a href="https://github.com/testcontainers/moby-ryuk">ryuk</a> which comes into play to <a href="https://stackoverflow.com/questions/71600706/why-docker-image-is-removed-at-the-end-of-the-tests-when-using-testcontainers">cleanup</a> containers after tests are executed and JVM exists.</p><pre>WARN 23489 --- [containers-ryuk] o.t.utility.RyukResourceReaper : <br>Can not connect to Ryuk at 127.0.0.1:32769<br>java.net.ConnectException: Connection refused</pre><p>But in my case the test case would auto clean up so I really didn’t need <em>ryuk </em>images. So I went ahead and disabled by exporting environment variable.</p><pre>export TESTCONTAINERS_RYUK_DISABLED=true</pre><p>Hope this blog help you setting up Colima and test containers.</p><p><strong>References</strong></p><p><a href="https://github.com/abiosoft/colima">https://github.com/abiosoft/colima</a></p><p><a href="https://github.com/abiosoft/colima/blob/main/docs/FAQ.md">https://github.com/abiosoft/colima/blob/main/docs/FAQ.md</a></p><p><a href="https://testcontainers.com/guides/getting-started-with-testcontainers-for-java/">https://testcontainers.com/guides/getting-started-with-testcontainers-for-java/</a></p><p><a href="https://github.com/testcontainers/moby-ryuk">https://github.com/testcontainers/moby-ryuk</a></p><p><a href="https://stackoverflow.com/questions/72557053/why-does-colima-failed-to-find-docker-daemon">https://stackoverflow.com/questions/72557053/why-does-colima-failed-to-find-docker-daemon</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=157c972d63f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>