{"id":3364,"date":"2024-01-17T02:15:00","date_gmt":"2024-01-17T07:15:00","guid":{"rendered":"https:\/\/www.both.org\/?p=3364"},"modified":"2024-01-13T05:36:28","modified_gmt":"2024-01-13T10:36:28","slug":"how-i-switched-from-docker-desktop-to-colima","status":"publish","type":"post","link":"https:\/\/www.both.org\/?p=3364","title":{"rendered":"How I switched from Docker Desktop to Colima"},"content":{"rendered":"<div class=\"pld-like-dislike-wrap pld-template-1\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"\" data-post-id=\"3364\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                        <i class=\"fas fa-thumbs-up\"><\/i>\r\n                <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">    <\/span>\r\n<\/div><\/div>\n<p class=\"wp-block-paragraph\">Colima is a Docker Desktop alternative for macOS and Linux that&#8217;s now supported by DDEV.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/github.com\/drud\/ddev\">DDEV<\/a>&nbsp;is an open source tool that makes it simple to get local PHP development environments up and running within minutes. It\u2019s powerful and flexible as a result of its per-project environment configurations, which can be extended, version controlled, and shared. In short, DDEV aims to allow development teams to use containers in their workflow without the complexities of bespoke configuration.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">DDEV replaces more traditional AMP stack solutions (WAMP, MAMP, XAMPP, and so on) with a flexible, modern, container-based solution. Because it uses containers, DDEV allows each project to use any set of applications, versions of web servers, database servers, search index servers, and other types of software.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\" id=\"in-march-2022-the-ddev-team-announced-support-for-colima-an-open-source-docker-desktop-replacement-for-macos-and-linux.-colima-is-open-source-and-by-all-reports-its-got-performance-gains--over-its-alternative-so-using-colima-seems-like-a-no-brainer.\">In March 2022, the DDEV team&nbsp;<a href=\"https:\/\/ddev.com\/ddev-local\/docker-desktop-alternatives-arrive-for-ddev-colima\/\">announced support for C<\/a><a href=\"https:\/\/ddev.com\/ddev-local\/docker-desktop-alternatives-arrive-for-ddev-colima\/\">olima<\/a>, an open source Docker Desktop replacement for macOS and Linux.&nbsp;<a href=\"https:\/\/github.com\/abiosoft\/colima\">Colima<\/a>&nbsp;is open source, and by all reports it\u2019s got&nbsp;<a href=\"https:\/\/ddev.com\/ddev-local\/docker-desktop-and-colima-benchmarking-on-macos\/\">performance gains<\/a>&nbsp;over its alternative, so using Colima seems like a no-brainer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"migrating-to-colima\">Migrating to Colima<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">First off, Colima is&nbsp;<em>almost<\/em>&nbsp;a drop-in replacement for Docker Desktop. I say&nbsp;<em>almost<\/em>&nbsp;because some reconfiguration is required when using it for an existing DDEV project. Specifically, databases must be reimported. The fix is to first export your database, then start Colima, then import it. Easy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Colima requires that either the Docker or&nbsp;<a href=\"https:\/\/opensource.com\/article\/22\/2\/start-running-containers\">Podman<\/a>&nbsp;command is installed. On Linux, it also requires Lima.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Docker is installed by default with Docker Desktop for macOS, but it\u2019s also available as a stand-alone command. If you want to go 100% pure Colima, you can uninstall Docker Desktop for macOS, and install and configure the Docker client independently.&nbsp;<a href=\"https:\/\/ddev.readthedocs.io\/en\/stable\/users\/docker_installation\/#macos-installation-colima\">Full installation instructions can be found on the DDEV docs site<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"647\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/01\/docker-desktop-colima.png\" alt=\"\" class=\"wp-image-3660\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you choose to keep using both Colima and Docker Desktop, then when issuing docker commands from the command line, you must first specify which container you want to work with. More on this in the next section.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"install-colima-on-macos\">Install Colima on macOS<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I currently have some local projects using Docker, and some using Colima. Once I understood the basics, it\u2019s not too difficult to switch between them.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>To get started, install Colima using Homebrew<code>&nbsp;brew install colima<\/code><\/li>\n\n\n\n<li><code>ddev poweroff<\/code>&nbsp;(just to be safe)<\/li>\n\n\n\n<li>Next, start Colima with&nbsp;<code>colima start --cpu 4 --memory 4.<\/code>&nbsp;The&nbsp;<code>--cpu<\/code>&nbsp;and&nbsp;<code>--memory<\/code>&nbsp;options only have to be done once. After the first time, only&nbsp;<code>colima start<\/code>&nbsp;is necessary.<\/li>\n\n\n\n<li>If you\u2019re a DDEV user like me, then you can spin up a fresh Drupal 9 site with the usual&nbsp;<code>ddev<\/code>&nbsp;commands (<code>ddev config, ddev start<\/code>, and so on.) It\u2019s recommended to enable DDEV\u2019s mutagen functionality to maximize performance.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"switching-between-a-colima-and-docker-desktop\">Switching between a Colima and Docker Desktop<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you\u2019re not ready to switch to Colima wholesale yet, it\u2019s possible to have both Colima and Docker Desktop installed.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>First, poweroff ddev:<code>ddev poweroff<\/code><\/li>\n\n\n\n<li>Then stop Colima:&nbsp;<code>colima stop<\/code><\/li>\n\n\n\n<li>Now run&nbsp;<code>docker context use default<\/code>&nbsp;to tell the Docker client which container you want to work with. The name&nbsp;<code>default<\/code>&nbsp;refers to Docker Desktop for Mac. When&nbsp;<code>colima start<\/code>&nbsp;is run, it&nbsp;<em>automatically<\/em>&nbsp;switches Docker to the&nbsp;<code>colima<\/code>&nbsp;context.<\/li>\n\n\n\n<li>To continue with the default (Docker Desktop) context, use the&nbsp;<code>ddev start<\/code>&nbsp;command.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Technically, starting and stopping Colima isn\u2019t necessary, but the&nbsp;<code>ddev poweroff&nbsp;<\/code>command when switching between two contexts is.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Recent versions of Colima revert the Docker context back to&nbsp;<code>default<\/code>&nbsp;when Colima is stopped, so the&nbsp;<code>docker context use default<\/code>&nbsp;command is no longer necessary. Regardless, I still use&nbsp;<code>docker context show<\/code>&nbsp;to verify that either the&nbsp;<code>default<\/code>&nbsp;(Docker Desktop for Mac) or&nbsp;<code>colima<\/code>&nbsp;context is in use. Basically, the term&nbsp;<code>context<\/code>&nbsp;refers to which container provider the Docker client routes commands to.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"try-colima\">Try Colima<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Overall, I\u2019m liking what I see so far. I haven\u2019t run into any issues, and Colima-based sites seem a bit snappier (especially when DDEV\u2019s Mutagen functionality is enabled). I definitely foresee myself migrating project sites to Colima over the next few weeks.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>This article originally appeared on the<\/em>&nbsp;<a href=\"https:\/\/www.drupaleasy.com\/news\"><em>DrupalEasy blog<\/em><\/a>&nbsp;<em>and is republished with permission.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Colima is a Docker Desktop alternative for macOS and Linux that&#8217;s now supported by DDEV.<\/p>\n","protected":false},"author":92,"featured_media":3365,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[214],"tags":[215,217],"class_list":["post-3364","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-macos","tag-colima","tag-docker-desktop"],"modified_by":"David Both","_links":{"self":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/3364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/users\/92"}],"replies":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3364"}],"version-history":[{"count":3,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/3364\/revisions"}],"predecessor-version":[{"id":3672,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/3364\/revisions\/3672"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/media\/3365"}],"wp:attachment":[{"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}