docker-compose-laravel icon indicating copy to clipboard operation
docker-compose-laravel copied to clipboard

Compose missing extension

Open jrean opened this issue 5 years ago • 4 comments

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

jrean avatar Mar 05 '20 13:03 jrean

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.

oranges13 avatar Mar 09 '20 18:03 oranges13

have a look at a pull request which present a better way to install php extensions. https://github.com/GitHM/docker-compose-laravel

GitHM avatar Mar 10 '20 17:03 GitHM

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.

oranges13 avatar Mar 10 '20 18:03 oranges13

#26 will fix this issue.

oranges13 avatar Apr 17 '20 14:04 oranges13

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.

aschmelyun avatar Nov 14 '22 05:11 aschmelyun