It was some time I wrote something in my blog. Since last my post I was wondering in various courses to learning about new web development technologies. Lastly I met Docker and it is awesome at least I image it is 🙂
So starting today I am going to start some blog series, how to setup PHP development environment based on Docker. In case you don’t know what Docker there is good post about it by Geoffrey Bachelet. He also has his own blog post of building PHP DE but I like to do things in my way, with little more details.
First things first, I am using Elementary OS, so any commands you would see in this series should work on any Ubuntu based OS, even on Boot2Docker thing. Installing Docker is quite easy just follow instructions for your system in official Docker documentation.
Now when all is set up we can start building our development environment. Now days in PHP composer is must go for every developer. I would be using composer Docker repository. To install just pull it like described with command:
$ docker pull composer/composer
Then use it like so:
$ docker run -t -i -v $(pwd):/app -u 1000 composer/composer init
Notice I added -u 1000
, this tells Docker to set me as owner for composer generated/installed files.
If command was successful you should see generated composer.json file. If not write comment below what OS you are using, maybe we would find solution together. Congratulations now you got now you have working composer in even PHP less environment.