Yuriy Gerasimov: DDEV and Docksal — docker based local development environments

When we are talking about tools for local development — there is a huge variety of options. It is less and less common to set up LAMP stack locally. Instead more developers use docker based environments. In Drupal world there are quite a few of them: docker4drupal, Lando, Docksal, DDEV.

In my last few years I used to work with Docksal and recently also started using DDEV. In this article I would like to demonstrate the differences between the two.

Maintainers

Docksal was initially built by FFW team. DDEV is maintained by Drud Technology. Both projects have online communities and leaders.

Docksal

This is the first docker based system I started playing with.

What I really liked is convenience. You can run fin drush <command> or fin drupal <command> to run drush or drupal console commands.

Another big thing is auto-starting projects. You can simply hit the URL of the project in your browser and it will start the environment for you. Meanwhile, you still can manually run fin up or fin stop (fin project start / fin project stop) to start and stop projects.

You can control things like enabled/disabled XDEBUG from editing docksal.env file. Main idea that you use docksal.env for all your configuration. Meanwhile, if you need more granular configuration like custom environment variables or custom php extensions you can edit docksal.yml file and extend appropriate section.

If you like to enable / disable XDEBUG for example you can run fin config set --env=local XDEBUG_ENABLED=1 && fin project start or edit docksal-local.env file manually and then run fin project start.

Docksal comes with a concept of addons. These are shortcuts to install additional containers. For example if you need PHPMyAdmin simply run fin addon install pma and you’ll get appropriate container added to your configuration.

Here is a list of all integrations that Docksal provides https://docs.docksal.io/tools/.

DDEV

I got introduced to DDEV after I worked with Docksal. Because they are based on the same technology stack there are a lot of things in common.

For example same as with Docksal, configuration is stored in two files: /.ddev/config.yaml and /.ddev/docker-compose.yaml that looked very familiar. Meanwhile there are way more configuration options by default in “config.yaml” file. Definitively recommend to look through them.

DDEV by default already comes with Mailhog and PHPMyAdmin containers.

In DDEV all commands inside of container are triggered with ddev exec command example: ddev exec drush <command>.

DDEV doesn’t have autostart feature, so you need to run ddev start every time.

What I really liked about DDEV is that you can install custom php extensions and packages without the need to dive into docker internals. There is a configuration option “webimage_extra_packages” that accomplishes that.

In order to enable / disable XDEBUG you simply run ddev exec enable_xdebug and ddev exec disable_xdebug.

Which one to choose? DDEV or Docksal?

It is hard to say. Specially for me as maintainers of both platforms are very good friends of mine.

Both platforms are based on the same technological stack so you find them really similar.

I found Docksal being more friends towards less technical people. Its auto start feature rocks. Also it definitely has a lot of options hidden from user that is a good thing for beginners.

DDEV is tailored towards more experienced users — it expose more things in configuration and make things easier if you need to customize your environment.

Can you use both?

Absolutely! The only place where projects overlap is NFS mounting. What I usually do when I need to switch between projects is enabling the proper mount.

For that on my Mac I edit /etc/exports file

# DDEV
/Users/ygerasimov -alldirs -mapall=501:20 localhost
# 
#/Users/ygerasimov/Projects 192.168.64.1 192.168.64.100 -alldirs -maproot=0:0
# ds-nfs>

And then restart nfs with sudo nfsd restart.

But make sure you check documentation Docksal, DDEV if you are on Linux or Windows. I am sure milage will vary.

Happy coding!

P.S. If you liked this article you can support my side project Diffy.

Tags: