% docker run --rm -i -t -v $PWD:/app composer create-project --prefer-dist laravel/laravel (YOUR PROJECT NAME HERE)
-tis not requirement, it's just a prettier.
- * Also
--rmtoo, it's to remove unnecessary containers.
- Installed docker(ex. Docker desktop for mac, windows or just Docker for linux)
- Fetch composer(latest) image from docker hub.(https://hub.docker.com/_/composer)
- Mount $PWD path of host to
/appof container directory.
create-project --prefer-dist laravel/laravel (YOUR PROJECT NAME HERE)in fetched container.
- Finally, you can see laravel project files in
(YOUR PROJECT NAME HERE)directory.
/app directory is specified working directory, from composer image via https://github.com/composer/docker/blob/582c6f4e10b6b8fbf9bc1c5b02d6ec24694fe8d4/2.0/Dockerfile#L60.
So, if composer's Dockerfile updated, then we must change mount directory path.
If you want use specific version laravel, then you can use "laravel/laravel=6.*" statement in your command.