I am trying to setup an existing project with Docker. The project is in codeigniter and uses memcached as the driver to set the session.
I created a Docker environment with php:7.1.8-apache and installed all the neccesary packages.
I am now getting this error on the page
Warning Message: session_start(): Failed to read session data: user (path: localhost:11211:128)
I searched this on the internet a lot and tried out many things but nothing works.
I have a file in application/libraries/Session/drivers/Session_memcached_driver.php
This is the the piece of code from where the error is generating but i am not sure what exactly it is.
public function read($session_id)
{
if (isset($this->_memcached) && $this->_get_lock($session_id))
{
// Needed by write() to detect session_regenerate_id() calls
$this->_session_id = $session_id;
$session_data = (string) $this->_memcached->get($this->_key_prefix.$session_id);
$this->_fingerprint = md5($session_data);
return $session_data;
}
return $this->_fail();
}
Here are my Docker Configurations:
FROM php:7.1.8-apache
# AUTHOR
MAINTAINER Development
# INSTALLING PACKAGES
RUN apt-get update && apt-get install -y \
git \
pkg-config \
build-essential \
libmemcached-dev \
libmemcached-tools \
libicu-dev \
libmcrypt-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libfreetype6 \
libfontconfig \
libxml2-dev \
vim \
nano \
mysql-client \
libldap2-dev \
wget
RUN apt-get clean
# Extension PHP
RUN docker-php-ext-install pdo pdo_mysql
RUN docker-php-ext-install intl
RUN docker-php-ext-install mbstring
RUN docker-php-ext-install bcmath
RUN docker-php-ext-install mcrypt
RUN docker-php-ext-install zip
RUN docker-php-ext-install exif
RUN docker-php-ext-install soap
RUN docker-php-ext-install opcache
RUN docker-php-ext-install iconv
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install gd
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
# APCu
RUN pecl channel-update pecl.php.net
RUN pecl install apcu
RUN echo "extension=apcu.so" > /usr/local/etc/php/conf.d/apcu.ini
# Enable PHP 7
RUN a2enmod rewrite && a2enmod headers && a2enmod expires
RUN a2enmod php7
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
# SETUP VIRTUAL HOST
COPY .docker/sites-available/default-vhost.conf /etc/apache2/sites-available/default-vhost.conf
COPY .docker/sites-available/my-vhost.conf /etc/apache2/sites-available/my-vhost.conf
RUN a2dissite 000-default.conf
RUN a2ensite default-vhost.conf
RUN a2ensite my-vhost.conf
# Composer
RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer
# Memcached
RUN apt-get update
RUN apt-get install -y pkg-config build-essential libmemcached-dev
RUN git clone https://github.com/php-memcached-dev/php-memcached.git
RUN cd php-memcached && git checkout php7 && phpize && ./configure --disable-memcached-sasl && make && make install
RUN echo 'extension = memcached.so' > /usr/local/etc/php/conf.d/memcached.ini
# ALIASES
RUN echo "alias ll='ls -l'" >> /root/.bashrc
RUN echo "alias la='ls -l'" >> /root/.bashrc
# COPY THE WORKING DIRECTORY
COPY . /var/www/myproject
# MANAGE DIRECTORY PERMISSIONS
RUN chown -R www-data:www-data /var/www/myproject
# SERVER RESTART
RUN service apache2 restart
And this is docker-compose.yml settings
version: '3'
services:
app:
build:
context: .
dockerfile: .docker/Dockerfile
container_name: gaz-container
image: gaz-docker
ports:
- "80:80"
volumes:
- .:/var/www/gaz
links:
- memcached:memcached
- mysql:mysql
memcached:
image: memcached
ports:
- "11211:11211"
mysql:
container_name: mysql
image: mysql:5.6
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=password
Can anyone please direct me what could be the issue here?
OMG.
After doing lot of searching i finally managed to get this working.
Thanks to dukebody. This post helped me to get hints about what i was doing wrong.
https://stackoverflow.com/a/27657937/4342075
The thing is i am actually creating multiple docker containers as you can see in the question in docker-compose.yml file. One of which is memcached. And i was trying to use memcached in the main container which is app.
What i was doing wrong is, i was using localhost:11211 to access memcached.
I just changed
$config['sess_save_path'] = 'localhost:11211:128'
To
$config['sess_save_path'] = 'memcached:11211';
And guess what it worked!!!
Related
I made a docker LAMP Stack Container including PHP7.3 and some extensions that I need to run my web application on. Recently I needed to include the sqlsrv extension to establish a connection to a MS SQL Server, it worked well for 1 day and when I restarted my Docker Desktop it rebuilt itself and now it's not working anymore even if I try to delete the images and volumes of the container and rebuild it.
When I run docker-compose up I get these two errors :
PHP Startup: Unable to load dynamic library 'pdo_sqlsrv.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20180731/pdo_sqlsrv.so (/usr/local/lib/php/extensions/no-debug-non-zts-20180731/pdo_sqlsrv.so: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20180731/pdo_sqlsrv.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20180731/pdo_sqlsrv.so.so: cannot open shared object file: No such file or directory))
PHP Startup: Unable to load dynamic library 'sqlsrv.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20180731/sqlsrv.so (/usr/local/lib/php/extensions/no-debug-non-zts-20180731/sqlsrv.so: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20180731/sqlsrv.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20180731/sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Here are my config files :
docker-compose.yml
version: '3.8'
volumes:
datafiles:
services:
mysql:
image: mysql:8.0.0
container_name: mysql8
environment:
- MYSQL_ROOT_PASSWORD=x
- MYSQL_TCP_PORT=x
volumes:
- datafiles:/var/lib/mysql
- "./scripts:/docker-entrypoint-initdb.d"
restart: always
phpmyadmin:
container_name: phpmyadmin
image: phpmyadmin/phpmyadmin:latest
restart: always
environment:
PMA_HOST: x
PMA_USER: x
PMA_PASSWORD: x
ports:
- "8081:80"
website:
container_name: php73
build:
context: .
dockerfile: Dockerfile
image: rootkitty/lamp-quietal-webapp:latest
env_file:
- .env
ports:
- 80:80
- 443:443
depends_on:
- mysql
Dockerfile the COPY php.ini permit to add
extension=sqlsrv.so
extension=pdo_sqlsrv.so
FROM php:7.3-apache
#Install git and MySQL extensions for PHP
ENV ACCEPT_EULA=Y
ENV MYSQL_DBHOST=x
ENV MYSQL_DBPORT=x
ENV MYSQL_DBUSER=x
ENV MYSQL_DBPASS=x
ENV MYSQL_DBNAME=x
# Install selected extensions and other stuff
RUN apt-get update \
&& apt-get -y --no-install-recommends install apt-utils libxml2-dev gnupg apt-transport-https \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
# Install git
RUN apt-get update \
&& apt-get -y install git \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
# Install MS ODBC Driver for SQL Server
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& apt-get -y --no-install-recommends install msodbcsql17 unixodbc-dev \
&& pecl install sqlsrv \
&& pecl install pdo_sqlsrv \
&& echo "extension=pdo_sqlsrv.so" >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/30-pdo_sqlsrv.ini \
&& echo "extension=sqlsrv.so" >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/30-sqlsrv.ini \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
RUN apt-get update && \
apt-get install -y \
git libzip-dev \
&& docker-php-ext-install zip
RUN docker-php-ext-install intl mysqli pdo pdo_mysql
RUN a2enmod rewrite
COPY scripts/php.ini /usr/local/etc/php
COPY www /var/www/html/
EXPOSE 80/tcp
EXPOSE 443/tcp
I followed the official Microsoft documentations to make up my Dockerfile :
https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15#debian17
https://learn.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac?view=sql-server-ver15#installing-on-debian
And gathered some codes on different GitHub pages. How can I achieve a proper sqlsrv installation on my docker container?
So, multiple things were not configured in the right way in my Dockerfile, here's the patch :
FROM php:7.3-apache
# Env variables
ENV ACCEPT_EULA=y
# Install selected extensions and other stuff
RUN apt-get update \
&& apt-get -y --no-install-recommends install apt-utils libxml2-dev gnupg apt-transport-https \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
# Install git
RUN apt-get update \
&& apt-get -y install git \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
#Install ODBC Driver
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update
# Install sqlsrv
RUN apt-get update
RUN apt-get install -y wget
RUN wget http://ftp.br.debian.org/debian/pool/main/g/glibc/multiarch-support_2.24-11+deb9u4_amd64.deb && \
dpkg -i multiarch-support_2.24-11+deb9u4_amd64.deb
RUN apt-get -y install msodbcsql17 unixodbc-dev
RUN pecl install sqlsrv pdo_sqlsrv
# Install webapp extension
RUN apt-get update && \
apt-get install -y \
git libzip-dev libicu-dev\
&& docker-php-ext-install zip
RUN docker-php-ext-install intl mysqli pdo pdo_mysql
RUN a2enmod rewrite
COPY scripts/php.ini /usr/local/etc/php
COPY www /var/www/html/
EXPOSE 80/tcp
EXPOSE 443/tcp
In fact I had to install multiarch-support for a reason that I still ignore despite it being a required package (if it's one ?). Then, I had to install the ODBC Drivers which I completely forgot in the first place.
From now everything seems to be working fine
We are running a laravel application by docker. We are creating a docker container using PHP-FPM (php:7.0-fpm official image) & NGINX. We use a common .env file for both docker and laravel applications.
we up & running our application by - docker-compose --env-file=./.env -f docker-compose.yml up -d
But the problem is when we change our .env file, the application not detected the change. We want to get every .env file change without re-creating the container.
Dockerfile -
FROM php:7.0-fpm
# PHP_CPPFLAGS are used by the docker-php-ext-* scripts
ENV PHP_CPPFLAGS="$PHP_CPPFLAGS -std=c++11"
# Install dependencies
RUN apt-get update && apt-get install -y \
nginx \
libpng-dev \
zlib1g-dev \
libsasl2-dev \
libssl-dev \
libjpeg62-turbo-dev \
libfreetype6-dev \
libpng-dev \
libxpm-dev \
libvpx-dev \
libxml2-dev \
libicu-dev \
git
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install extensions
RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/
RUN docker-php-ext-configure intl
RUN docker-php-ext-install -j$(nproc) pdo_mysql mbstring zip calendar soap gd intl
# Install mongodb extension
RUN pecl install mongodb-1.4.4 \
&& echo "extension=mongodb.so" > /usr/local/etc/php/conf.d/mongo.ini
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=1.8.6
RUN composer global require hirak/prestissimo
COPY entrypoint.sh /etc/entrypoint.sh
RUN chmod +x /etc/entrypoint.sh
RUN usermod -u 1000 www-data
# Set working directory
WORKDIR /var/www
EXPOSE 80 443
Docker Compose -
version: '3.5'
services:
api-service:
environment:
SERVICE_NAME: app
VIRTUAL_HOST: ${API_DOMAIN}
working_dir: /var/www
entrypoint: /etc/entrypoint.sh
volumes:
- ../../:/var/www
- ../nginx/conf.d/nginx-local.conf:/etc/nginx/sites-enabled/default
- ../php/local.ini:/usr/local/etc/php/conf.d/local.ini
- ../php/memory_limit.ini:/usr/local/etc/php/conf.d/memory_limit.ini
- ../php/php.ini:/usr/local/etc/php/conf.d/php.override.ini
- ../php/www.conf:/usr/local/etc/php-fpm.d/www.conf
ports:
- ${PORT}:80
networks:
api-service-network:
external:
name: ${EXTERNAL_NETWORK}
entrypoint -
#!/usr/bin/env bash
service nginx start
php-fpm
So is it possible to reload ENV (on local development by PHP-FPM) without recreating the container.
Try using env_file in docker-compose
Maybe can help you
I can't build any image with PHP-Memcached extension. All they give me an error messages and how many times I try it's not helpful. I can't even find any PHP Dockerfile which include memcached and it's work. Even the main page of PHP docker page have Dockerfile with PHP Memcached solution and it's also not working.
FROM php:5.6-cli
RUN apt-get update && apt-get install -y libmemcached-dev zlib1g-dev \
&& pecl install memcached-2.2.0 \
&& docker-php-ext-enable memcached
Here is my last try code
FROM php:7.4-fpm
ADD php.ini /usr/local/etc/php/conf.d/php.ini
RUN docker-php-ext-install pdo pdo_mysql
# for mysqli if you want
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
RUN printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y libz-dev libmemcached-dev && \
pecl install memcached && \
docker-php-ext-enable memcached
Who knows about this something? Thanks, advice
Looks like I found the solution on my problem at last and it's connected with /etc/apt/source.list
deb http://ftp.us.debian.org/debian buster main
deb http://ftp.us.debian.org/debian buster-updates main
And then just add this COPY ./sources.list /etc/apt/sourcee.list line in your Dockerfile and it will work
FROM php:7.2-fpm
COPY ./sources.list /etc/apt/sourcee.list
I have separated memcached and phm-memcached. The first one is a container, and second is installed on Dockerfile for PHP.
My docker-compose file :
version: '3'
services:
# PHP
php:
build:
context: docker/php7-fpm
volumes:
// etc...
memcached:
image: memcached:latest
hostname: memcached
networks:
- stack
And in my Dockerfile for PHP:
FROM php:7-4-fpm
// install dependencies...
# php-memcached
RUN set -ex \
&& rm -rf /var/lib/apt/lists/* \
&& MEMCACHED="`mktemp -d`" \
&& curl -skL https://github.com/php-memcached-dev/php-memcached/archive/master.tar.gz | tar zxf - --strip-components 1 -C $MEMCACHED \
&& docker-php-ext-configure $MEMCACHED \
&& docker-php-ext-install $MEMCACHED \
&& rm -rf $MEMCACHED
And with this, in my symfony application, i can store data in memcached.
I am trying to setup Docker for my application relying on an LEMP stack. To this end, I plan to use Docker compose in order to spawn one container for Nginx, one for PHP-FPM and one for MySQL.
This is all working well for the basic illustration use-cases found in the online tutorials, but when I try to apply it to my use-case, I struggle with a design issue.
To give a bit of context, my web application relies on Composer for PHP dependencies and Gulp+Bower for CSS/JS dependencies (and LESS compilation, assets minimization, etc.).
The problem is that I need to build the application (i.e. install all dependencies and run some gulp tasks) and provide the result of this build to both Nginx and PHP-FPM containers.
Here is what I have come to so far:
docker-compose.yml:
version: "3"
networks:
database:
server:
volumes:
mysql-data:
source:
services:
php:
build: .
volumes:
- source:/app:ro
restart: always
networks:
- database
- server
depends_on:
- mysql
mysql:
image: mysql:5.7
volumes:
- mysql-data:/var/lib/mysql
restart: always
networks:
- database
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_USER: test
MYSQL_PASSWORD: test
MYSQL_DATABASE: test
nginx:
image: nginx
volumes:
- source:/app:ro
restart: always
networks:
- server
depends_on:
- php
Dockerfile:
FROM php:7.1-fpm
WORKDIR /app
# Install dependencies
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get update && apt-get install -y \
git \
nodejs \
zip
RUN curl -sL https://getcomposer.org/installer | php -- --install-dir /usr/bin --filename composer
# Get application dependencies
COPY composer.json ./
RUN composer install -o
COPY package.json gulpfile.js bower.json ./
RUN npm install
RUN npm run gulp
RUN npm run rev
# Copy application
COPY . ./
However, as a Docker beginner, I am not sure it is right to rely on a volume for the build result of the application, or to have the build steps part of one of the containers running the application.
Thanks in advance for any help or advice!
Nicolas
However, as a Docker beginner, I am not sure it is right to rely on a volume for the build result of the application, or to have the build steps part of one of the containers running the application.
Short answer: Named volumes are the correct way to handle this.
In previous versions of compose, you would use the volumes-from option to reference an existing volume in a different container. This is deprecated in v3, being replaced by named volumes which you appear to be implementing correctly. I mention volumes-from because I think it does a good job of showing the intention of volumes - to persist data between containers - where named volumes is a bit less descriptive.
Look this for PHP7-FPM - NGINX - MySQL - ELK : https://github.com/maxpou/docker-symfony
And this for container management : https://portainer.io
My custom docker file with Node / Gulp
/php7-fpm/Dockerfile
FROM php:7.0-fpm
RUN apt-get update && apt-get install -y \
git \
unzip \
wget \
ntp \
gnupg
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
RUN apt-get install -y nodejs
RUN npm config set registry "http://registry.npmjs.org/"
RUN npm install -g gulp bower
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN composer --version
# Set timezone
RUN rm /etc/localtime
RUN ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime
RUN "date"
# Type docker-php-ext-install to see available extensions
RUN docker-php-ext-install pdo_mysql
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng-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
# install xdebug
#RUN pecl install xdebug
#RUN docker-php-ext-enable xdebug
#RUN echo "error_reporting = E_ALL" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
#RUN echo "display_startup_errors = On" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
#RUN echo "display_errors = On" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
#RUN echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
#RUN echo "xdebug.remote_connect_back=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
#RUN echo "xdebug.idekey=\"PHPSTORM\"" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
#RUN echo "xdebug.remote_port=9001" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN apt-get update \
&& apt-get -y install \
libmagickwand-dev \
--no-install-recommends \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& rm -r /var/lib/apt/lists/*
RUN echo "file_uploads = On\n" \
"memory_limit = 500M\n" \
"upload_max_filesize = 500M\n" \
"post_max_size = 500M\n" \
"max_execution_time = 600\n" \
> /usr/local/etc/php/conf.d/uploads.ini
RUN echo "realpath_cache_ttl = 7200\n" \
"realpath_cache_size = 4M\n" \
> /usr/local/etc/php/conf.d/opti-symfony.ini
RUN echo "date.timezone=Europe/Paris" \
> /usr/local/etc/php/conf.d/time-zone.ini
RUN docker-php-ext-install opcache
WORKDIR /var/www/symfony
If you have an error gives us ;)
Happy Docker
I have been trying to install memcached in my php-5.6 container, however I am unable to get it working, as i don't see memcached extension in phpinfo() and plus for some reason it's complaining about that it can't find the memcache.so in the code.
there is my docker-file for php build
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://github.com/phalcon/cphalcon.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
nginx:
build: ./.config/etc/nginx/
ports:
- 7000:80
links:
- php
- memcached:memcached
volumes_from:
- app
memcached:
image: memcached:latest
php:
build: ./.config/etc/php/
expose:
- 9000
links:
- mysql
- memcached:memcached
volumes_from:
- app
app:
image: php:5.6-fpm
#image: php:7.0-fpm
volumes:
- ./:/var/www/vhosts/example.com/httpdocs
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: 192.168.99.1, server: www.example.dev, request: "GET /search HTTP/1.1", upstream: "fastcgi://172.17.0.5:9000", host: "192.168.99.100:7000"
What is going wrong here?
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