Skip to content

Using the ddev Command

Type ddev help or ddev --help or ddev -h in a terminal window to see the available DDEV commands. There are commands to configure a project, start, stop, describe, etc. Each command also has help using ddev help <command> or ddev command -h. For example, ddev help snapshot will show help and examples for the snapshot command.

Interactive Dashboard

Running ddev with no arguments launches an interactive terminal dashboard. The dashboard shows all your DDEV projects and their status, and lets you manage them with these keyboard shortcuts.

Key Action
Enter Open project detail view
↑ / ↓ or k / j Move the selection, or scroll the detail and log views
PgUp/b / PgDn/f, Home/g / End/G Scroll the list, detail or logs a screen at a time, or jump to the start or end
u / d Scroll the detail or logs half a screen up or down
Esc / Backspace Go back
/ Filter projects by name, type, status, or directory name; Enter, Tab, ↑ or ↓ ends typing, and Esc clears the filter
r Refresh
? Show or hide the full list of keys
q Quit

Projects

Key Action
s / S Start / Stop the project
R Restart the project
D Delete the project and its database, like ddev delete; confirm with y, or O to skip the snapshot
l Launch project URL in browser
m Launch Mailpit in browser
x Launch XHGui in browser
o Open project directory in the file manager
v / p Open project in VS Code / PhpStorm
e SSH into web container (detail view)
L Follow logs (detail view)
X Toggle Xdebug (detail view)
c Copy the project URL (detail view)
n Make a database snapshot, like ddev snapshot, while the project runs (detail view)
N Restore the latest snapshot, like ddev snapshot restore --latest; confirm with y (detail view)
U Update the installed add-ons that have a newer release, like ddev add-on update; confirm with y (detail view)
a / A Start all / Stop all projects; confirm with y
P Poweroff all DDEV projects and containers; confirm with y
C Run ddev config interactively in the current directory

Commands such as start and delete run in the terminal itself, so their output, errors included, stays in the terminal after you quit the dashboard.

In terminals that support OSC 8 hyperlinks, project paths and URLs in the dashboard and detail view are clickable, as are the VS Code and PhpStorm links in the detail view. The editor links use the vscode:// and phpstorm:// URL schemes, so they work only when that editor is installed, and some terminals block those schemes. PhpStorm does not register phpstorm:// on Windows, so there the PhpStorm link needs a separately installed handler. The p key avoids this by using PhpStorm’s command-line launcher when it is on your PATH, which JetBrains Toolbox can install.

To disable the dashboard and show the classic help text instead, set no_tui: true in your global configuration ($HOME/.ddev/global_config.yaml), or set the environment variable DDEV_NO_TUI=true.

Terminal Compatibility

The dashboard automatically detects your terminal’s color capabilities and adapts its output. If colors or styling don’t render correctly in your terminal, you have several options:

  • Disable colors: Run NO_COLOR=1 ddev or export NO_COLOR=1 in your shell to disable all color output while keeping the dashboard functional.
  • Use simple formatting globally: Run ddev config global --simple-formatting=true to disable colors and table formatting across all DDEV commands, including the dashboard. See simple_formatting.
  • Set TERM appropriately: If your terminal supports color but DDEV doesn’t detect it, make sure your TERM environment variable is set correctly (e.g., xterm-256color). Some SSH clients or multiplexers like tmux or screen may need explicit configuration.
  • Disable the dashboard entirely: If the interactive dashboard doesn’t work well in your environment (e.g., a very limited terminal or CI), use DDEV_NO_TUI=true or set no_tui: true in $HOME/.ddev/global_config.yaml to fall back to the classic help output.

  • ddev config configures a project’s type and docroot, either interactively or with flags.

  • ddev start starts up a project.
  • ddev launch opens a web browser showing the project.
  • ddev list shows current projects and their state.
  • ddev describe gives all the info about the current project.
  • ddev ssh takes you into the web container.
  • ddev exec <command> executes a command inside the web container.
  • ddev stop stops a project and removes its memory usage (but does not throw away any data).
  • ddev poweroff stops all resources that DDEV is using and stops the Mutagen daemon if it’s running.
  • ddev delete destroys the database and DDEV’s knowledge of the project without touching your code.
  • ddev add-on adds an add-on service.

Lots of Other Commands

  • ddev mysql gives direct access to the MySQL client and ddev psql to the PostgreSQL psql client.
  • ddev sequelace, ddev tableplus, ddev tablepro, and ddev querious (macOS only, if the app is installed) give access to the Sequel Ace, TablePlus, TablePro or Querious database browser GUIs.
  • ddev dbeaver (if installed) gives access to the DBeaver database browser GUI.
  • ddev heidisql (Windows/WSL2/Linux, if installed) gives access to the HeidiSQL database browser GUI.
  • ddev import-db and ddev export-db import or export SQL or compressed SQL files.
  • ddev composer runs Composer inside the container. For example, ddev composer install will do a full composer install for you without even needing Composer on your computer. See developer tools.
  • ddev snapshot makes a very fast snapshot of your database that can be easily and quickly restored with ddev snapshot restore.
  • ddev share requires ngrok and at least a free account on ngrok.com so you can let someone in the next office or on the other side of the planet see your project and what you’re working on. ddev share -h gives more info about how to set up ngrok.
  • ddev xdebug enables Xdebug, ddev xdebug off disables it, and ddev xdebug status shows status. You can toggle Xdebug on and off easily using ddev xdebug toggle.
  • ddev xhprof enables xhprof, ddev xhprof off disables it, and ddev xhprof status shows status.
  • ddev xhgui enables XHGui, ddev xhgui off disables it, and ddev xhgui status shows status.
  • ddev dr (Drupal 11.4+ only) gives direct access to the dr CLI, the next-generation Drupal CLI available in Drupal 11.4+.
  • ddev drush (Drupal and Backdrop only) gives direct access to the drush CLI.
  • ddev artisan (Laravel only) gives direct access to the Laravel artisan CLI.
  • ddev asterios (Asterios only) gives direct access to the Asterios asterios CLI.
  • ddev magento (Magento2 only) gives access to the magento CLI.
  • ddev maho (Maho only) gives direct access to the maho CLI.
  • ddev console (Symfony and Shopware only) gives access to the symfony console CLI.
  • ddev craft (Craft CMS only) gives access to the craft CLI.
  • ddev npm gives direct access to the npm CLI.
  • ddev npx gives direct access to the npx CLI.
  • ddev yarn gives direct access to the yarn CLI.
  • ddev cake (CakePHP only) gives direct access to the cake CLI.
  • ddev sake (Silverstripe CMS only) gives direct access to the sake CLI.
  • ddev spark (CodeIgniter) gives direct access to the spark CLI.
  • ddev typo3 (TYPO3 only) gives direct access to the typo3 CLI.
  • ddev wp (WordPress and Bedrock only) gives direct access to the wp CLI.

Node.js Tools

node, nodejs, npm, npx and yarn are preinstalled in the web container. You can configure the default value of the installed Node.js version with the nodejs_version option in .ddev/config.yaml or with ddev config --nodejs-version. There is also a ddev yarn command.

More Bundled Tools

In addition to the commands listed above, there are lots of tools included inside the containers:

  • ddev describe tells how to access Mailpit, which captures email in your development environment.
  • Composer, Git, Node.js, npm, symfony, and dozens of other tools are installed in the web container, and you can access them via ddev ssh or ddev exec.
  • ddev logs gets you web server logs; ddev logs -s db gets database server logs.
  • sqlite3 and the mysql and psql clients are inside the web container (and mysql or psql client is also in the db container).

Exporting a Database

You can export a database with ddev export-db, which outputs to stdout or with options to a file:

ddev export-db --file=/tmp/db.sql.gz
ddev export-db --file=/tmp/db.sql
ddev export-db --compression=zstd >/tmp/db.sql.zst
ddev export-db >/tmp/db.sql.gz

ddev import-files

To import static file assets for a project, such as uploaded images and documents, use the command ddev import-files. This command will prompt you to specify the location of your import asset, then import the assets into the project’s upload directory. To define a custom upload directory, set the upload_dirs config option. If no custom upload directory is defined, the default will be used:

  • For Backdrop projects, this is the files directory.
  • For Craft CMS projects, this is the files directory.
  • For Drupal projects, this is the sites/default/files directory.
  • For Magento 1 projects, this is the media directory.
  • For Magento 2 projects, this is the media directory.
  • For Shopware projects, this is the media directory.
  • For Silverstripe CMS projects, this is the assets directory.
  • For TYPO3 projects, this is the fileadmin directory.
  • For WordPress projects, this is the wp-content/uploads directory.
  • For WordPress Bedrock projects, this is the app/uploads directory.

Other project types need a custom configuration to be able to use this command.

$ ddev import-files
Provide the path to the source directory or archive you wish to import.
Please note: if the destination directory exists, it will be emptied and replaced with the
import assets specified here.
Path to file(s): ~/workspace/d10/.tarballs/files.tgz
You provided an archive. Do you want to extract from a specific path in your
archive? You may leave this blank if you wish to use the full archive contents.
Archive extraction path:
Successfully imported files for d10

ddev import-files supports the following file types: .tar, .tar.gz, .tar.xz, .tar.bz2, .tar.zst, .tgz, or .zip.

It can also import a directory containing static assets.

If using a Tar or ZIP archive, the archive should contain only the files inside the files directory. For example in a Drupal site with files at sites/default/files, the archive should only contain the contents of the files directory; it should not contain a single files directory. To do this with the tar command, cd into the directory and create the archive there. An example Tar file creation is:

cd web/sites/default/files
tar -czf ~/Downloads/files.tgz .

If you want to use import-files without answering prompts, use the --source or -s flag to provide the path to the import asset. If you’re importing an archive, and wish to specify the path within the archive to extract, you can use the --extract-path flag in conjunction with the --source flag. Example:

ddev import-files --source=/tmp/files.tgz

When multiple upload_dirs are defined and you want to import to another upload dir than the first one, use the --target or -t flag to provide the path to the desired upload dir:

ddev import-files --target=../private --source=/tmp/files.tgz

See ddev help import-files for more examples.

Snapshotting and Restoring a Database

The project database is stored in a Docker volume, but can be snapshotted (and later restored) with the ddev snapshot command. A snapshot is automatically taken when you run ddev stop --remove-data. For example:

ddev snapshot
Creating database snapshot d9_20220107124831-mariadb_10.3.gz
Created database snapshot d9_20220107124831-mariadb_10.3.gz

ddev snapshot restore d9_20220107124831
Stopping db container for snapshot restore of 'd9_20220107124831-mariadb_10.3.gz'...
Restored database snapshot d9_20220107124831-mariadb_10.3.gz

Snapshots are stored as gzipped files in the project’s .ddev/db_snapshots directory, and the file created for a snapshot can be renamed as necessary. For example, if you rename the above d9_20220107124831-mariadb_10.3.gz file to working-before-migration-mariadb_10.3.gz, then you can use ddev snapshot restore working-before-migration. (The description of the database type and version—mariadb_10.3, for example—must remain intact.) To restore the latest snapshot add the --latest flag (ddev snapshot restore --latest).

List snapshots for an existing project with ddev snapshot --list. (Add the --all option for an exhaustive list; ddev snapshot --list --all.) You can remove all of them with ddev snapshot --cleanup, or remove a single snapshot with ddev snapshot --cleanup --name <snapshot-name>.

Tip

The default 120-second timeout may be inadequate for restores with very large snapshots or slower systems. You can increase this timeout by setting default_container_timeout to a higher value.

A timeout doesn’t necessarily mean the restore failed; you can watch the snapshot restore complete by running ddev logs -s db.

Interacting with Your Project

DDEV provides several commands to facilitate interacting with your project in the development environment. These commands can be run within the working directory of your project while the project is running in DDEV.

Executing Commands in Containers

The ddev exec command allows you to run shell commands in the container for a DDEV service. By default, commands are executed on the web service container, in the docroot path of your project. This allows you to use the developer tools included in the web container. For example, to run the ls command in the web container, you would run ddev exec ls or ddev . ls.

To run a shell command in the container for a different service, use the --service (or -s) flag at the beginning of your exec command to specify the service the command should be run against. For example, to run the MySQL client in the database, container, you would run ddev exec --service db mysql. To specify the directory in which a shell command will be run, use the --dir flag. For example, to see the contents of the /usr/bin directory, you would run ddev exec --dir /usr/bin ls.

To run privileged commands, sudo can be passed into ddev exec. For example, to update the container’s apt package lists, use ddev exec sudo apt-get update.

Commands can also be executed using the shorter ddev . <cmd> alias.

Normally, ddev exec commands are executed in the container using Bash, which means that environment variables and redirection and pipes can be used. For example, a complex command like ddev exec 'ls -l ${DDEV_FILES_DIR} | grep x >/tmp/junk.out' will be interpreted by Bash and will work. However, there are cases where Bash introduces too much complexity and it’s best to run the command directly. In those cases, something like ddev exec --raw ls -l "dir1" "dir2" may be useful. With --raw, the ls command is executed directly instead of the full command being interpreted by Bash. But you cannot use environment variables, pipes, redirection, etc.

SSH Into Containers

The ddev ssh command opens an interactive Bash or sh shell session to the container for a DDEV service. The web service is connected by default, and the session can be ended by typing exit. To connect to another service, use the --service flag to specify the service you want to connect to. For example, to connect to the database container, you would run ddev ssh --service db. To specify the destination directory, use the --dir flag. For example, to connect to the database container and be placed into the /home directory, you would run ddev ssh --service db --dir /home.

You can also use your personal SSH keys within the web container. Run ddev auth ssh to add the keys from your ~/.ssh directory and provide a passphrase, and those keys will be usable from within the web container. You generally only have to ddev auth ssh one time per computer reboot. This is a very popular approach for accessing private Composer repositories, or for using drush aliases against remote servers.

If your keys live in an SSH agent rather than in ~/.ssh, as with 1Password or a hardware key, see Using an Existing SSH Agent.

Using an Existing SSH Agent

If you already use an SSH agent, such as the macOS agent, 1Password, Secretive, gpg-agent with a YubiKey, or one forwarded with ssh -A, DDEV’s containers can use it directly. Set this once:

ddev config global --ssh-agent-upstream=host
ddev auth ssh      # lists the keys your containers can use

After that, every project’s containers use your agent when they start, with nothing to add per project. ddev auth ssh only shows which keys are available, and ddev exec ssh -T git@github.com tests them. Every container on the DDEV network can ask your agent to sign while this is on; agents that confirm each use, like 1Password, limit that exposure.

If ddev auth ssh says “Make sure that agent is running and holds your keys”, your agent is stopped or locked; open it or load your keys, and DDEV picks it up again without a restart. To go back to adding key files, run ddev config global --ssh-agent-upstream="" and then ddev auth ssh.

If a connection instead fails with “Too many authentication failures”, the server capped how many keys it will try, and relaying a whole agent offers more than the few keys you’d add by hand; see Too Many Authentication Failures to limit which key gets offered per host.

macOS: which agent do my containers get?

That depends on your Docker provider:

Provider What to do Agent containers get
OrbStack Nothing extra The agent named by IdentityAgent in ~/.ssh/config, such as 1Password, otherwise the macOS agent. Restart OrbStack after changing ~/.ssh/config.
Docker Desktop Nothing extra Always the macOS agent
Colima Start it with colima start --ssh-agent Always the macOS agent
Lima Run limactl edit <instance> --set .ssh.forwardAgent=true once Always the macOS agent
Rancher Desktop, Podman Not supported DDEV warns and uses its own agent; add key files with ddev auth ssh as usual

To use 1Password, Secretive, or gpg-agent:

  • With OrbStack, set IdentityAgent in ~/.ssh/config as your agent’s setup instructions describe, then restart OrbStack.
  • Docker Desktop, Colima, and Lima ignore IdentityAgent. Point the system-wide SSH_AUTH_SOCK at your agent as its documentation describes; for 1Password, see Configure SSH_AUTH_SOCK globally for every client.
  • Exporting SSH_AUTH_SOCK in your shell profile doesn’t reach any of these providers.

To use the macOS agent, load your keys into it, saving the passphrase in the Keychain:

ssh-add --apple-use-keychain ~/.ssh/id_ed25519
ssh-add -l
Linux: pointing at your own agent

host uses the agent in $SSH_AUTH_SOCK when a project starts. A forwarded agent (ssh -A) gets a new socket for each login, so run ddev auth ssh again after logging in again. When the socket is a symlink, as with VS Code Remote’s /tmp/vscode-ssh-auth-sock-*, DDEV uses the socket it points to. After VS Code or SSH reconnects, a terminal opened earlier still points to the old, dead socket, so run ddev auth ssh from a new terminal. A desktop agent’s socket doesn’t change, so you can set it directly, for example on Ubuntu with ddev config global --ssh-agent-upstream=/run/user/$(id -u)/gcr/ssh. An agent you start yourself with eval $(ssh-agent -s) works when you run ddev from that shell; to use it from any shell, start it on a fixed socket with mkdir -p -m 700 ~/.ssh-agent && eval $(ssh-agent -a ~/.ssh-agent/agent.sock -s) and set ddev config global --ssh-agent-upstream=$HOME/.ssh-agent/agent.sock. Keep the socket in its own directory rather than ~/.ssh, because DDEV mounts the socket’s whole directory into the ddev-ssh-agent container.

Docker Desktop: using an agent forwarded with ssh -A

Docker Desktop relays the agent in the SSH_AUTH_SOCK it started with, not your shell’s, and a forwarded agent gets a new socket for each login. To follow each new login without restarting Docker Desktop, start it once on a fixed path and point that path at each login’s socket from ~/.ssh/rc, which sshd runs at login:

# Once. On macOS, use 'launchctl setenv SSH_AUTH_SOCK ...' and 'docker desktop restart' instead.
mkdir -p -m 700 ~/.ssh-agent-forward
systemctl --user set-environment SSH_AUTH_SOCK=$HOME/.ssh-agent-forward/agent.sock
systemctl --user restart docker-desktop

# In ~/.ssh/rc:
if [ -n "$SSH_AUTH_SOCK" ]; then ln -sf "$SSH_AUTH_SOCK" ~/.ssh-agent-forward/agent.sock; fi

The most recent ssh -A login wins, and after it ends, containers can’t reach an agent until you log in again. With X11 forwarding, ~/.ssh/rc also has to run xauth, as man sshd describes. The Docker Desktop setting doesn’t last past a reboot.

WSL2: bridging a Windows agent

DDEV can’t reach Windows agents such as 1Password and the Windows OpenSSH agent directly, because they listen only on a Windows named pipe. Bridge that pipe to a Unix socket with socat in WSL2 and npiperelay on Windows, then point DDEV at the socket. DDEV doesn’t start the bridge for you. This works with Docker Desktop’s WSL integration as well as Docker installed inside WSL2, although Docker Desktop on Windows doesn’t forward an agent of its own.

  1. Install socat in WSL2 with sudo apt install socat, and npiperelay in PowerShell with winget install albertony.npiperelay. npiperelay is x64-only; Windows on Arm runs it under emulation.
  2. With systemd enabled in WSL2, run the bridge as a user service, which starts with WSL2 whether or not you open a shell. Run this in a WSL2 shell, where npiperelay.exe is on PATH; the service itself doesn’t get the Windows PATH, so the unit records the full path:

    mkdir -p ~/.config/systemd/user
    cat > ~/.config/systemd/user/ssh-agent-bridge.service <<EOF
    [Unit]
    Description=Bridge the Windows SSH agent to ~/.1password/agent.sock
    
    [Service]
    ExecStartPre=/usr/bin/mkdir -p -m 700 %h/.1password
    ExecStart=/usr/bin/socat UNIX-LISTEN:%h/.1password/agent.sock,fork,unlink-early EXEC:"$(command -v npiperelay.exe) -ei -s //./pipe/openssh-ssh-agent",nofork
    Restart=on-failure
    SuccessExitStatus=143
    
    [Install]
    WantedBy=default.target
    EOF
    systemctl --user enable --now ssh-agent-bridge
    

    Without systemd, add this to ~/.bashrc instead, so that each new shell starts the bridge if it isn’t already running:

    export SSH_AUTH_SOCK=$HOME/.1password/agent.sock
    ssh-add -l >/dev/null 2>&1
    if [ $? -eq 2 ]; then
      rm -f "$SSH_AUTH_SOCK"
      mkdir -p -m 700 "$(dirname "$SSH_AUTH_SOCK")"
      (setsid socat UNIX-LISTEN:"$SSH_AUTH_SOCK",fork EXEC:"npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork &) >/dev/null 2>&1
    fi
    
  3. Check that SSH_AUTH_SOCK=~/.1password/agent.sock ssh-add -l lists your keys, then run:

    ddev config global --ssh-agent-upstream=$HOME/.1password/agent.sock
    ddev auth ssh
    

To use the same agent for ssh and git in WSL2, add export SSH_AUTH_SOCK=$HOME/.1password/agent.sock to ~/.bashrc. If the bridge stops, containers can’t use your keys until it runs again, and nothing in DDEV needs a restart.

Traditional Windows: key files, or piping from 1Password

ssh_agent_upstream doesn’t work here. Windows agents, including 1Password and the Windows OpenSSH agent, listen on a named pipe that Docker Desktop and other Windows providers can’t pass to containers. DDEV warns and uses its own agent, so add your key files from %USERPROFILE%\.ssh with ddev auth ssh. To use a key stored in 1Password without saving it to a file, pipe it from the 1Password CLI, in PowerShell or Git Bash:

op read "op://<vault>/<item>/private key?ssh-format=openssh" | ddev auth ssh -f -

Turn on Settings > Developer > Integrate with 1Password CLI in the 1Password app first, and add --account <account>.1password.com to op read if you’re signed in to more than one account. Run the command again after ddev poweroff or a reboot, because DDEV’s agent forgets keys when it stops.

ddev logs

The ddev logs command allows you to easily view error logs from the web container (both nginx/Apache and php-fpm logs are concatenated). To follow the logs in real time, run ddev logs -f. When you’re done, press CTRL + C to exit the log trail. Similarly, ddev logs -s db will show logs from a running or stopped database container.

Stopping a Project

To remove a project’s containers, run ddev stop in the project’s working directory. To remove any running project’s containers regardless of context, specify the project name as an argument: ddev stop <projectname>.

ddev stop is not destructive. It removes the Docker containers but does not remove the database for the project, and does nothing to your code. This allows you to have many configured projects with databases loaded without wasting Docker containers on unused projects. ddev stop does not affect the project codebase and files.

To remove the imported database for a project, use the flag --remove-data, as in ddev stop --remove-data. This command will destroy both the containers and the imported database contents.