ddev uses its own COMPOSER_CACHE_DIR and doesn't use any composer cache on the host

Created on 25 Jun 2020  路  4Comments  路  Source: drud/ddev

Is your feature request related to a problem? Please describe.
I'm frustrated with the ddev composer create --repository=https://repo.magento.com/ magento/project-community-edition. Whenever I give this command it downloads new instead of reusing from any near-where place.

Describe the solution you'd like
Using - '~/.composer/cache:/mnt/ddev-global-cache/composer:rw,delegated' volume would work if I could be able to control ddev start

Describe alternatives you've considered
How can I use ddev start so that I can mount any volume or another command before before containers are being created.

Additional context

Most helpful comment

Yes, that is correct. Ddev has no way to assume it knows where there might be a host-side composer cache or whether composer exists on the host at all, and it is not dependent on composer or PHP being installed on the host. The composer cache is in the docker volume ddev-global-cache, and is available inside the web container at /mnt/ddev-global-cache/composer. It's shared among all ddev projects. If you ddev exec 'echo $COMPOSER_CACHE_DIR' you'll see that.

All 4 comments

Hi @itsazzad - ddev uses a docker volume for its composer cache, and it's shared among all projects.

Mostly people who use ddev don't need composer on the host, so there's no cache there, and the shared ddev cache can be substantial.

@rfay Are you meaning that the shared ddev cache is shared in between different ddev setups?
Let me guess that first project setup with ddev will download all composer packages repo but from second project it will try to load from the ddev cache; Is that so?
So it is only cacheable in between ddev projects but not other composer projects; is it?

Yes, that is correct. Ddev has no way to assume it knows where there might be a host-side composer cache or whether composer exists on the host at all, and it is not dependent on composer or PHP being installed on the host. The composer cache is in the docker volume ddev-global-cache, and is available inside the web container at /mnt/ddev-global-cache/composer. It's shared among all ddev projects. If you ddev exec 'echo $COMPOSER_CACHE_DIR' you'll see that.

It sounds like this is understood now, so closing. Happy to continue the conversation here.

Was this page helpful?
0 / 5 - 0 ratings