Updating Composer Packages With Docker
As I don't have Composer installed directly on my server with my many Docker containers of my websites, and I don't run
composer update in the Docker image(s) for my websites I was able to use the Composer Docker image to update packages by running the Composer image within the directory of my website(s). It worked something like this:
cd /home/jimmy/public_html/jimmyb.ninja docker run --rm --interactive --tty --volume $PWD:/app composer update
This will mount the directory you're presently in into the Composer image and then will run
composer update command. The result is updated packages!
There was one website I have which has a Composer package that required
bcmath, which of course I didn't have installed as well as wasn't available in the Docker image, so I was able to get around this doing this instead:
cd /home/jimmy/public_html/jimmyb.ninja docker run --rm --interactive --tty --volume $PWD:/app composer update --ignore-platform-reqs
Hopefully this helps someone else out!