Docker Azure Cli + PHP
I’m a fan of PHP and docker make my life better. It’s difficult to maintain our favorite tool in a live system as our host system keeps updating and it could break our tool. I want to run Azure CLI in a docker environment. It’s easy to start , just using this command:
1 2 |
docker run -it mcr.microsoft.com/azure-cli |
My problem is that, this Microsoft image doesn’t have the tool i need – it’s PHP. I want to do some cool stuff with PHP and Azure CLI. So, why don’t we build a new Azure CLI image from our existing Microsoft Azure CLI ? Finally, i go with this Dockerfile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
FROM mcr.microsoft.com/azure-cli RUN apk --no-cache add \ php7 \ php7-ctype \ php7-curl \ php7-dom \ php7-fileinfo \ php7-ftp \ php7-iconv \ php7-json \ php7-mbstring \ php7-mysqlnd \ php7-openssl \ php7-pdo \ php7-pdo_sqlite \ php7-pear \ php7-phar \ php7-posix \ php7-session \ php7-simplexml \ php7-sqlite3 \ php7-tokenizer \ php7-xml \ php7-xmlreader \ php7-xmlwriter \ php7-zlib |
To build it, it’s easy
1 |
sudo docker build . -t azure-php |
To run it, it’s easy
1 |
sudo docker run -it -v /home/myaccount:/Data/ azure-php |
As you can see i add -v /home/myaccount: /Data , this is because i want to share my home folder with the container.
Good luck.
Leave a Reply