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:

docker run -it

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


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 \

To build it, it’s easy

sudo docker build . -t azure-php

To run it, it’s easy

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

Your email address will not be published. Required fields are marked *