docker-compose-laravel
docker-compose-laravel copied to clipboard
Compose missing extension
Hi,
Thank you for your 2 articles...
I'm wondering how would you handle such situation.
I have (like you suggest) a separate composer container.
I require in my composer.json a package that requires exif extension.
When I run docker-compose run --rm composer install it starts (all good) but stops with:
Your requirements could not be resolved to an installable set of packages.... requires ext-exif
Of course I can require this extension in the Dockerfile and then run the composer commands from the php container but what if I want to keep your flow? How can I make this separate composer container working? Do I have to extend and rebuild the composer image? Is there another way?
Thanks
I'm working on a method to have this "just work" in the docker-compose.yml or Dockerfile, however, you can do this with the composer image like so docker-compose run --rm composer install --ignore-platform-reqs
The --ignore-platform-reqs flag will allow it to install all your composer dependencies without consideration for missing extensions.
have a look at a pull request which present a better way to install php extensions. https://github.com/GitHM/docker-compose-laravel
Hey @GitHM -- the reason you were having "weird docker errors" with your volume declaration is because you were linking a folder rather than a volume -- which if there's data there you're going to have an issue.
You used:
volumes:
- ./backup_data:/filesystem/folder
Whereas docker dynamic volumes are just names, rather than folders:
volumes:
- backup_data:/filesystem/folder # notice there's no leading ./
That should resolve the errors you mentioned in your notes. In addition, docker-php-ext-install works fine in my build files -- if you're having issues with it you might want to submit an Issue / PR with specific information of what you were attempting to fix.
#26 will fix this issue.
This should be fixed with the latest update, that consolidates composer under the main php image, this way they share the same version and software.