Science and technology

How I switched from Docker Desktop to Colima

DDEV is an open supply device that makes it easy to get native PHP improvement environments up and working inside minutes. It’s highly effective and versatile on account of its per-project atmosphere configurations, which may be prolonged, model managed, and shared. In brief, DDEV goals to permit improvement groups to make use of containers of their workflow with out the complexities of bespoke configuration.

DDEV replaces extra conventional AMP stack options (WAMP, MAMP, XAMPP, and so forth) with a versatile, trendy, container-based answer. Because it makes use of containers, DDEV permits every venture to make use of any set of purposes, variations of net servers, database servers, search index servers, and different sorts of software program.

In March 2022, the DDEV staff announced support for Colima, an open supply Docker Desktop substitute for macOS and Linux. Colima is open supply, and by all experiences it’s received performance gains over its different, so utilizing Colima looks like a no brainer.

Migrating to Colima

First off, Colima is nearly a drop-in substitute for Docker Desktop. I say nearly as a result of some reconfiguration is required when utilizing it for an current DDEV venture. Specifically, databases have to be reimported. The repair is to first export your database, then begin Colima, then import it. Easy.

Colima requires that both the Docker or Podman command is put in. On Linux, it additionally requires Lima.

Docker is put in by default with Docker Desktop for macOS, but it surely’s additionally obtainable as a stand-alone command. If you wish to go 100% pure Colima, you may uninstall Docker Desktop for macOS, and set up and configure the Docker consumer independently. Full installation instructions can be found on the DDEV docs site.

(Mike Anello,CC BY-SA 4.0)

If you select to maintain utilizing each Colima and Docker Desktop, then when issuing docker instructions from the command line, you could first specify which container you wish to work with. More on this within the subsequent part.

Install Colima on macOS

I presently have some native initiatives utilizing Docker, and a few utilizing Colima. Once I understood the fundamentals, it’s not too troublesome to modify between them.

  1. To get began, set up Colima utilizing Homebrew brew set up colima

  2. ddev poweroff (simply to be secure)

  3. Next, begin Colima with colima begin --cpu 4 --memory 4. The --cpu and --memory choices solely must be finished as soon as. After the primary time, solely colima begin is important.

  4. If you’re a DDEV person like me, then you may spin up a recent Drupal 9 website with the standard ddev instructions (ddev config, ddev begin, and so forth.) It’s really useful to allow DDEV’s mutagen performance to maximise efficiency.

Switching between a Colima and Docker Desktop

If you’re not prepared to modify to Colima wholesale but, it’s attainable to have each Colima and Docker Desktop put in.

  1. First, poweroff ddev:ddev poweroff

  2. Then cease Colima: colima cease

  3. Now run docker context use default to inform the Docker consumer which container you wish to work with. The title default refers to Docker Desktop for Mac. When colima begin is run, it robotically switches Docker to the colima context.

  4. To proceed with the default (Docker Desktop) context, use the ddev begin command.

Technically, beginning and stopping Colima isn’t obligatory, however the ddev poweroff command when switching between two contexts is.

Recent variations of Colima revert the Docker context again to default when Colima is stopped, so the docker context use default command is not obligatory. Regardless, I nonetheless use docker context present to confirm that both the default (Docker Desktop for Mac) or colima context is in use. Basically, the time period context refers to which container supplier the Docker consumer routes instructions to.

Try Colima

Overall, I’m liking what I see to this point. I haven’t run into any points, and Colima-based websites appear a bit snappier (particularly when DDEV’s Mutagen performance is enabled). I positively foresee myself migrating venture websites to Colima over the subsequent few weeks.

This article initially appeared on the DrupalEasy blog and is republished with permission.

Most Popular

To Top