LinuxCommandLibrary

ddev

Create and manage local development environments

TLDR

Start up a project

$ ddev start
copy

Configure a project's type and docroot
$ ddev config
copy

Follow the log trail
$ ddev logs [[-f|--follow]]
copy

Run composer within the container
$ ddev composer
copy

Install a specific Node.js version
$ ddev nvm install [version]
copy

Export a database
$ ddev export-db [[-f|--file]] [/tmp/db.sql.gz]
copy

Run a specific command within a container
$ ddev exec [echo 1]
copy

SYNOPSIS

ddev [options] [arguments]

Examples:
ddev start
ddev config
ddev exec "drush status"
ddev pull pantheon

PARAMETERS

start
    Starts the ddev project's services and makes it accessible locally.

stop
    Stops the ddev project's services without removing their data.

restart
    Restarts the ddev project's services.

config
    Configures a new or existing ddev project, setting up environment details.

exec [command]
    Executes a command inside the project's web container (e.g., ddev exec "php -v").

ssh
    Connects to the project's web container via SSH.

pull [provider]
    Pulls database and files from a configured hosting provider (e.g., Pantheon, Acquia).

push [provider]
    Pushes database and files to a configured hosting provider (use with caution).

list
    Lists all ddev projects, showing their status and URLs.

delete
    Deletes a ddev project, removing its services and all associated data.

DESCRIPTION

ddev is an open-source tool that makes it easy to set up and manage local PHP development environments using Docker. It automates the creation of web servers (Nginx/Apache), databases (MySQL/PostgreSQL), and other services required for web projects. Designed for developer experience, ddev provides simple command-line access to your containers, supports various PHP versions, and integrates seamlessly with popular CMS like Drupal, WordPress, Laravel, and Symfony. Its core benefits include consistency across development teams, easy environment sharing, and robust extensibility through add-ons.

CAVEATS

ddev requires Docker Desktop (or Docker Engine on Linux) to be installed and running. Performance can sometimes be impacted by underlying Docker configurations, especially on macOS (e.g., file system performance) or Windows (requiring WSL2 for optimal speed). It's important to ensure sufficient system resources are allocated to Docker for complex projects.

ADD-ONS AND EXTENSIBILITY

ddev boasts a powerful add-on system (`ddev get`) that allows users to easily integrate additional services (e.g., Solr, Redis, Memcached), tools, and custom configurations into their projects. This extensibility makes it highly adaptable to diverse project requirements.

HOSTING PROVIDER INTEGRATION

A key feature of ddev is its built-in integration with popular hosting providers like Pantheon, Acquia, Platform.sh, and others. This enables developers to easily pull and push databases and files directly from their live or staging environments to their local ddev setup, streamlining development workflows.

HISTORY

ddev was initially developed by Drud Technology (now Pantheon) in 2017 with a primary focus on streamlining local Drupal development workflows. Over time, its scope expanded to support a wide array of PHP frameworks and general web development. Its open-source nature and active community have led to continuous improvements, making it a robust and popular choice for local development environments.

SEE ALSO

docker(1), docker-compose(1), lando(1), valet(1), vagrant(1)

Copied to clipboard