Search code examples
drushddev

How can I get my ssh keys and identity into ddev's web container?


I have these needs from time to time in the web container:

  • ssh to a server from inside the web container
  • Use git to a private repository inside the web container
  • Use rsync (like ddev drush rsync)
  • Use ddev composer with access to private repositories

So how can I get my keys into the container?


Solution

  • DDEV supports having your ssh keys in the container without mounting them there, using an ssh-agent inside docker.

    You can authenticate and add your keys via ddev auth ssh, and they will then be available from every project. This works for ssh from inside the container, private composer repositories, and drush rsync.

    See https://ddev.readthedocs.io/en/stable/users/basics/cli-usage/#ssh-into-containers for docs.