yiisoft / yii2-app-advanced

Yii 2.0 Advanced Application Template
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
1.66k stars 1.29k forks source link

docker-compose run --rm backend /app/init not working #457

Closed fleduc closed 4 years ago

fleduc commented 4 years ago

I'm trying to start a new Yii2 advanced project using Docker.

Since I'm only using Docker on my local dev environment (no Php, Composer, etc installed locally), I've followed your "Installing using Docker" procedure found here

As per your procedure, in my console (Cmder).

Running this command worked docker-compose run --rm backend composer install

Running this command did not work docker-compose run --rm backend /app/init

Error message: usermod: no changes /usr/bin/env: 'php\r': No such file or directory

Note: Yesterday I've tried to create a basic Yii2 project using your Git basic repo and procedure and everything worked seamlessly.

Can somebody help me here?

Thanks

Additional info

Q A
Yii version 2
PHP version 7.2
Operating system Win10 Pro
VM VirtualBox-DockerToolbox
vkaterusha commented 4 years ago

This is an an issue with Windows line endings \r.

From my Windows OS to bypass the \r issue I run the command like this: docker-compose run --rm backend php init

Here is a good article on the difference between Windows and Linux line endings: https://willi.am/blog/2016/08/11/docker-for-windows-dealing-with-windows-line-endings/

fleduc commented 4 years ago

Thanks vkaterusha.

I have found that this can also be solved by using this command:

docker-compose run --rm backend php /app/init

or this one

docker-compose run --rm backend php init

Could documentation be modified?

Thanks again

samdark commented 4 years ago

Yes. A pull request would be very helpful.

fleduc commented 4 years ago

I have noticed that I have the same behavior with this command:

docker-compose run --rm backend yii migrate

but it work with this one

docker-compose run --rm backend php yii migrate

I'll add this too in the pull request.