Docker – install php-memcached extenstion not working?

I have been trying to install memcached in my php-5.6 container, however i am unable to get it working, as i dont see memcached extenstion in phpinfo() and plus for some reason its complianing about that it cant find the in the code.

there is my docker-file for php build

  • Variable cgroups parametres in Docker
  • serving multiple docker microservices behind nginx proxy
  • Docker build extra folders
  • Run shell script inside Docker container from another Docker container?
  • Docker File: Chmod on Entrypoint Script
  • Error running openshift/origin docker: Error running 'chcon' to set the kubelet volume root directory SELinux context
  • FROM php:5.6-fpm
    RUN apt-get update && apt-get install -y \
            libfreetype6-dev \
            libjpeg62-turbo-dev \
            libmcrypt-dev \
            libpng12-dev \
        && docker-php-ext-install -j$(nproc) iconv mcrypt \
        && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
        && docker-php-ext-install -j$(nproc) gd     
    RUN docker-php-ext-install mysqli mbstring pdo_mysql 
    # Download and Installing php libraries 
    RUN apt-get install -y memcached
    RUN apt-get -y install php-pear php5-dev php5-memcached geoip-bin geoip-database libgeoip-dev php5-geoip
    # Download and Installing php libraries 
    RUN pecl install geoip
    # Download and Installing git and vim 
    RUN apt-get -y install git gcc  
    RUN pwd
    RUN git clone --depth=1 git:// 
    WORKDIR /var/www/html/cphalcon/build
    RUN ./install
    EXPOSE 9000
    EXPOSE 11211
    COPY ./php-fpm.d/www.conf /etc/php-fpm.d/www.conf
    COPY ./php.ini  /usr/local/etc/php/php.ini 
    COPY ./php-fpm.conf /etc/php-fpm.conf
    COPY ./phalcon.ini /usr/local/etc/php/conf.d/phalcon.ini
    COPY ./geoip.ini /usr/local/etc/php/conf.d/geoip.ini
    COPY ./memcached.ini /usr/local/etc/php/conf.d/memcached.ini

    And my docker compose file is

        build: ./.config/etc/nginx/
            - 7000:80
            - php
            - memcached:memcached            
            - app
      image: memcached:latest   
        build: ./.config/etc/php/
            - 9000
            - mysql
            - memcached:memcached            
            - app
        image: php:5.6-fpm
        #image: php:7.0-fpm
            - ./:/var/www/vhosts/
        command: "true"

    The error i am getting on the code is

    [36;1mnginx_1 | [0mPHP message: PHP Fatal error: Class ‘memcache’ not found in Unknown on line 0″ while reading response header from upstream, client:, server:, request: “GET /search HTTP/1.1”, upstream: “fastcgi://”, host: “”

    Any ideas on what is going wrong here ?

  • Docker cannot run hello-world from client
  • cannot reach web app from docker host (not docker-machine)
  • Can dockerized containers truly run on any Linux node?
  • Cannot start container lstat no such file or directory
  • docker run with cd command fails with executable file not found in $PATH
  • How to create --link for 2 containers to link to each other?
  • One Solution collect form web for “Docker – install php-memcached extenstion not working?”

    The php images ship a custom-compiled PHP, but are based on a Debian Jessie image (and use Debian’s repositories). With apt-get install php5-memcached, you install the memcached extension for the distribution’s PHP package (which is installed along the way).

    You need to install the memcached extension via PECL (and its build dependencies via APT):

    RUN apt-get update
    RUN apt-get install -y libz-dev libmemcached-dev && \
        pecl install memcached && \
        docker-php-ext-enable memcached
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.