Currently the php-memcached-dev:php7 branch contains the source for this extension.
To install it you can still use the docker-php-ext-*
commands but you need to checkout the source yourself.
Base Installation
Assuming everything required to install the extension is already installed you can do:
RUN git clone -b php7 https://github.com/php-memcached-dev/php-memcached /usr/src/php/ext/memcached \
&& docker-php-ext-configure /usr/src/php/ext/memcached \
--disable-memcached-sasl \
&& docker-php-ext-install /usr/src/php/ext/memcached \
&& rm -rf /usr/src/php/ext/memcached
This block will clone the repository, configure and install the extension then clean up after it self.
Pre-requisites
It is most likely that you need to install to packages to build the extension, we can add and remove them by doing:
ENV MEMCACHED_DEPS zlib-dev libmemcached-dev cyrus-sasl-dev git
RUN set -xe \
&& apk add --no-cache libmemcached-libs zlib \
&& apk add --no-cache \
--virtual .memcached-deps \
$MEMCACHED_DEPS \
&& git clone -b php7 https://github.com/php-memcached-dev/php-memcached /usr/src/php/ext/memcached \
&& docker-php-ext-configure /usr/src/php/ext/memcached \
--disable-memcached-sasl \
&& docker-php-ext-install /usr/src/php/ext/memcached \
&& rm -rf /usr/src/php/ext/memcached \
&& apk del .memcached-deps
Update 17 May 2017
memcached
has been added to the official pecl libraries for php7 now (v3 -> php7/7.1, v2 -> php5)
This makes installation a bit different
FROM php:7.0-alpine
ENV MEMCACHED_DEPS zlib-dev libmemcached-dev cyrus-sasl-dev
RUN apk add --no-cache --update libmemcached-libs zlib
RUN set -xe \
&& apk add --no-cache --update --virtual .phpize-deps $PHPIZE_DEPS \
&& apk add --no-cache --update --virtual .memcached-deps $MEMCACHED_DEPS \
&& pecl install memcached \
&& echo "extension=memcached.so" > /usr/local/etc/php/conf.d/20_memcached.ini \
&& rm -rf /usr/share/php7 \
&& rm -rf /tmp/* \
&& apk del .memcached-deps .phpize-deps