title: Docker service failed to build : return a non-zero code 1
body: <p>I tried to install some needed extensions for php using docker.</p>
  
  <p>Here is my Dockerfile :</p>
  
  <pre><code>FROM php:7-fpm
  
  RUN apt-get update &amp;&amp; apt-get install -y \
      libfreetype6-dev \
      libjpeg62-turbo-dev \
      libmcrypt-dev \
      libpng12-dev \
      libsqlite3-dev \
      libssl-dev \
      libcurl3-dev \
      libxml2-dev \
      libzzip-dev \
  &amp;&amp; docker-php-ext-install iconv json mcrypt mbstring mysql mysqli pdo_mysql pdo_sqlite phar curl ftp hash session simplexml tokenizer xml xmlrpc zip \
  &amp;&amp; docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
  &amp;&amp; docker-php-ext-install gd
  
  WORKDIR /var/www
  
  CMD ["php7-fpm"]
  </code></pre>
  
  <p>And here is the error I got :</p>
  
  <blockquote>
    <p>error: /usr/src/php/ext/mysql does not exist</p>
    
    <p>usage: /usr/local/bin/docker-php-ext-install [-jN] ext-name [ext-name ...]
       ie: /usr/local/bin/docker-php-ext-install gd mysqli
           /usr/local/bin/docker-php-ext-install pdo pdo_mysql
           /usr/local/bin/docker-php-ext-install -j5 gd mbstring mysqli pdo pdo_mysql shmop</p>
    
    <p>if custom ./configure arguments are necessary, see docker-php-ext-configure</p>
    
    <p>Possible values for ext-name:
    bcmath bz2 calendar ctype curl dba dom enchant exif fileinfo filter ftp gd gettext gmp hash iconv imap interbase intl json ldap mbstring mcrypt mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline recode reflection session shmop simplexml snmp soap sockets spl standard sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zip</p>
    
    <p>ERROR: Service 'php-localdev' 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         libsqlite3-dev         libssl-dev         libcurl3-dev         libxml2-dev         libzzip-dev     &amp;&amp; /usr/local/bin/docker-php-ext-install iconv json mcrypt mbstring mysql mysqli pdo_mysql pdo_sqlite phar curl ftp hash session simplexml tokenizer xml xmlrpc zip     &amp;&amp; /usr/local/bin/docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/     &amp;&amp; /usr/local/bin/docker-php-ext-install gd' </p>
    
    <p>returned a non-zero code: 1</p>
  </blockquote>
  
  <p>Do you see any issues in my Dockerfile, or the problem is elsewhere ?</p>
  
  <p>I was inspired for this Dockerfile by the <a href="https://hub.docker.com/_/php/" rel="noreferrer">php docker hub</a>.</p>
  
  <p>Thansk for your help.</p>