Using Composer image locally?

Asked by At

As far as I understand the official composer image is meant to be used as a is php management tool and not like any other images you can use within the docker-compose file. So basically I can use the docker container if I don't have or don't want to install composer locally/nativelly.

So, I have created a root directory for my app which is empty at the moment, but if I run for example docker run --rm -it -volume $PWD:/app composer create-project laravel/laravel . I can't see the Laravel app being installed within my directory. Have I missunderstood something ora any ideas what I'm doing wrong?

1 Answers

Community On Best Solutions

You should either use the flag -v or --volume. This command worked for me, just make sure you are in an empty directory:

docker run --rm -it -v $PWD:/app composer create-project laravel/laravel .