In-Container Home Directory and Shell Configuration¶
Custom shell configuration (Bash or your preferred shell), your usual Git configuration, a Composer auth.json and more can be achieved within your containers.
Place all your dotfiles in your global~/.ddev/homeadditions or your project’s .ddev/homeadditions directory and DDEV will use these in your project’s web containers.
Ignore .ddev/.homeadditions!
A hidden/transient .ddev/.homeadditions—emphasis on the leading .—is used for processing global homeadditions and should be ignored.
On ddev start, DDEV attempts to create a user inside the web and db containers with the same name and user ID as the one you have on the host machine.
DDEV looks for the homeadditions directory both in the global ~/.ddev/homeadditions directory and the project-level .ddev/homeadditions directory, and will copy their contents recursively into the in-container home directory during ddev start. Project homeadditions contents override the global homeadditions.
Usage examples:
- If you use Git inside the container, you may want to symlink your
~/.gitconfiginto~/.ddev/homeadditionsor the project’s.ddev/homeadditionsso that in-containergitcommands use whatever username and email you’ve configured on your host machine. For example,ln -s ~/.gitconfig ~/.ddev/homeadditions/.gitconfig. -
If you use SSH inside the container and want to use your
.ssh/config, considermkdir -p ~/.ddev/homeadditions/.ssh && ln -s ~/.ssh/config ~/.ddev/homeadditions/.ssh/config. Some people will be able to symlink their entire.sshdirectory,ln -s ~/.ssh ~/.ddev/homeadditions/.ssh. If you provide your own.ssh/configthough, please make sure it includes these lines: -
If you need to add a script or other executable component into the project (or global configuration), you can put it in the project or global
.ddev/homeadditions/bindirectory and~/bin/<scriptwill be created inside the container. This is useful for adding a script to one project or every project, or for overriding standard scripts, as~/binis first in the$PATHin thewebcontainer. - If you use private, password-protected Composer repositories with Satis, for example, and use a global
auth.json, you might want tomkdir -p ~/.ddev/homeadditions/.composer && ln -s ~/.composer/auth.json ~/.ddev/homeadditions/.composer/auth.json, but be careful that you exclude it from getting checked in by using a.gitignoreor equivalent. - You can add small scripts to the
.bashrc.ddirectory and they will be executed onddev ssh. For example, add a~/.ddev/homeadditions/.bashrc.d/whereamicontainingecho "I am in the $(hostname) container"and (afterddev restart) when youddev sshthat will be executed. - If you have a favorite
.bashrc, copy it into either the global or projecthomeadditions. -
If you like the traditional
llBash alias forls -l, add a.ddev/homeadditions/.bash_aliaseswith these contents: