With Docker, should I use Composer in the container or host?

Asked

Viewed 435 times

2

I have some questions about the development environment. I have a project in Laravel and I’m using Docker. When using Composer or Artisan from Laravel, what is the right place to do this? On my host machine or in the Docker container?

  • The idea of the container is not ease ? Why would I leave PHP out ?

  • 1

    If you are going to use Docker the ideal would be to create a Docker container with your Laravel settings, after that in this same container you can use Composer to install third-party Components or create your own. Today I saw a very interesting example. laradock.io/Getting-Started.

1 answer

2


If there is a need to reuse cached packages for other projects (when you install a package Composer caches not to download again if you create or install the package in another project) then I recommend using the host’s Composer, but if it doesn’t make much difference you can use the container’s Composer.

Please note that for this purpose you must be using a image that brings the installed Composer or you can create your own image containing any stack you want.

If you want to use ready-made images (with php, Poser.. etc) recommend the ambientum.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.