I have a nonstandard composer layout, so some of my tools are in docroot/vendor/bin instead of the expected vendor/bin, so they're not in the $PATH inside the web container, and tools like ddev drush
or ddev typo3cms
don't work right because they can't find the tool. What can I do?
Asked
Active
Viewed 120 times
0

rfay
- 9,963
- 1
- 47
- 89
1 Answers
1
There are at least a couple of ways to solve this problem. The simplest is probably to just symlink your tool(s) into /usr/local/bin
where they will easily be found. There are at least a couple of ways to do this. (Note that for most projects, the best long-term solution is to use a standard composer layout with the composer.json in the project root and the vendor directory in the project root, but we all know we can't fix everything. But vendor/bin
is always in the $PATH.. so that's the usual easiest way to do this.)
- Symlink in a post-start hook: We can add a post-start hook to symlink typo3cms (for example) into /usr/local/bin and
ddev typo3cms
will find the tool. Add something like this to.ddev/config.yaml
hooks:
post-start:
- exec: ln -s /var/www/html/docroot/vendor/bin/typo3cms /usr/local/bin
- Symlink in a
.ddev/web-build/Dockerfile
: To add a symlink to drush, for example, in a nonstandard location and makeddev drush
work, add this file as.ddev/web-build/Dockerfile
:
ARG BASE_IMAGE
FROM $BASE_IMAGE
RUN ln -s /var/www/html/docroot/vendor/bin/drush /usr/local/bin
I'm sure there are many other ways to do this, by manipulating the $PATH inside the container (by adding .bashrc inside the homeadditions feature)

rfay
- 9,963
- 1
- 47
- 89