title: Docker Compose - Installing php-fpm with MySQLi, MySQLnd and PDO extensions
body: <p>I am trying to setup docker on computer (Mac) and I am unable to compile PDO_mysql extension.</p>
  
  <p>My docker-compose file looks like following</p>
  
  <pre><code>version: '2'
    services:
      nginx:
          image: tutum/nginx
          ports:
              - "80:80"
          links:
              - phpfpm
          volumes:
              - ./nginx/conf:/etc/nginx/sites-available/
              - ./nginx/conf:/etc/nginx/sites-enabled/
  
              - ./logs/nginx-error.log:/var/log/nginx/error.log
              - ./logs/nginx-access.log:/var/log/nginx/access.log
      phpfpm:
          build: ./php
          ports:
              - "9000:9000"
          volumes:
              - ./Sites:/usr/share/nginx/html
      mysql:
        image: mysql
        environment:
          MYSQL_ROOT_PASSWORD: admin
        ports:
          - "3306:3306" 
  </code></pre>
  
  <p>My Dockfile looks like following:</p>
  
  <pre><code>FROM php:5.6-fpm
  RUN apt-get update &amp;&amp; apt-get install -y \
          libfreetype6-dev \
          libjpeg62-turbo-dev \
          libmcrypt-dev \
          libpng12-dev \
      &amp;&amp; docker-php-ext-install -j$(nproc) iconv mcrypt mysqli \
      &amp;&amp; docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
      &amp;&amp; docker-php-ext-install -j$(nproc) gd 
  </code></pre>
  
  <p>The above files work fine, BUT if in the 3rd last file, if I add <strong>mysqlnd</strong> I cannot build my php.</p>
  
  <pre><code>            Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20131226/
              Installing header files:           /usr/local/include/php/
              find . -name \*.gcno -o -name \*.gcda | xargs rm -f
              find . -name \*.lo -o -name \*.o | xargs rm -f
              find . -name \*.la -o -name \*.a | xargs rm -f 
              find . -name \*.so | xargs rm -f
              find . -name .libs -a -type d|xargs rm -rf
              rm -f libphp.la       modules/* libs/*
              + cd mysqlnd
              + phpize
              Cannot find config.m4. 
              Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module
  
              ERROR: Service 'phpfpm' failed to build: The command '/bin/sh -c apt-get update &amp;&amp; apt-get install -y       libfreetype6-dev        libjpeg62-turbo-dev         libmcrypt-dev       libpng12-dev    &amp;&amp; docker-php-ext-install -j$(nproc) iconv mcrypt mysqli mysqlnd    &amp;&amp; docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/  &amp;&amp; docker-php-ext-install -j$(nproc) gd' returned a non-zero code: 1
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>Please advise. </p>
  
  <p>Thanks</p>