DEV Community

Discussion on: Do you use Docker?

Collapse
 
owenmelbz profile image
Owen Melbourne

I think it depends how robust your computer configuration is, e.g. on macOS the amount of effort setting up multiple docker environments for each configuration of PHP when you can effectively just do..

brew link php@7.4 or brew link php@8

Easily swap, same with Node, can swap the above commands for node.

It's great docker has solved this problem for you, many ways to solve the problem. For us typing a single command every so often is much less overhead than virtualisation for development.

Thread Thread
 
andreidascalu profile image
Andrei Dascalu

Yeah, but there are 2 issues with this:

  • you need to maintain your own environment, including config and building your extensions specifically for Mac. Aside from the issue of development lib availability for building extensions for Mac, there is also the problem of simply doing so. The amqp extension doesn't work for Mac with php8 (or wasn't last time I tried, about 2 months ago), there are different versions of the lib for each of the 7.x versions, unlike Linux where the one before last is available across the board.
  • more for a team perspective, there's no guarantee the same settings/features will be available, they will depend on what's available in the native platform.

On a centrally managed docker file there is only one concern: building libraries for a given Linux architecture and that's it. Which is usually easy since it is the first supported on every update for php extensions and easiest to find docs for when needing to build it (I would list the horror of trying to build imagick 6 with heif support on Mac to the list - not the easiest thing on Linux either, but still easier)
Any of these operations may require specific system level dependencies (mainly kernel headers and other build deps) which isn't always possible if you do want to have a stable local system.
With Docker, I don't care, I can brew upgrade anything while in my project Dockerfile I can manually build stuff that may depend on curl 5.

Thread Thread
 
owenmelbz profile image
Owen Melbourne

I agree with what you're saying, BUT. I had originally said:

100% great tool with perfect use cases, but often found people use it when just not needed

Everything you're describing are tools/websites with very specific needs - It's not often somebody needs to upload a heif images - This is my exact point :) Most websites don't need anything fancy and work fine - so Docker is too much, but IF you have a specific non-standard requirement, then this is where these tools become useful.

Funnily enough we picked up a PHP 5.6 project the other week using an ancient ruby, gulp and compass configuration - I laughed to myself thinking this was a good candidate for a containerised project :) But I proved my own point, A complex problem needs a more complex solution! Whereas everything else works fine!