利用Dockerfile安装,基础镜像php:7.2-fpm
> yum install docker
#拉取php镜像
> yum pull php:7.2-fpm
利用Dockerfile构建新的镜像
> touch Dockerfile
>echo 'FROM php:7.2-fpm
RUN mkdir -p /usr/src/php/ext/redis
RUN curl -L https://github.com/phpredis/phpredis/archive/3.0.0.tar.gz | tar xvz -C /usr/src/php/ext/redis --strip 1
RUN echo 'redis' >> /usr/src/php-available-exts
RUN docker-php-ext-install redis
RUN mkdir -p /usr/src/rabbitmq-c
RUN curl -L https://github.com/alanxz/rabbitmq-c/releases/download/v0.7.1/rabbitmq-c-0.7.1.tar.gz | tar xvz -C /usr/src/rabbitmq-c --strip 1
RUN cd /usr/src/rabbitmq-c && ./configure --prefix=/usr/local/rabbitmq-c && make && make install
RUN mkdir -p /usr/src/php/ext/amqp
RUN curl -l https://pecl.php.net/get/amqp-1.9.3.tgz | tar xvz -C /usr/src/php/ext/amqp --strip 1
RUN echo 'amqp' >> /usr/src/php-available-exts && cp /usr/src/rabbitmq-c/librabbitmq/amqp_ssl_socket.h /usr/src/php/ext/amqp/
RUN docker-php-ext-configure amqp --with-librabbitmq-dir=/usr/local/rabbitmq-c && docker-php-ext-install amqp
RUN php -m | grep amqp
EXPOSE 9000
' >>Dockerfile
>docker build -t php:php-fpm-ext-redis-rabbitmq