I'm trying to create my first image, which I forked from someone else, and I'm running into an issue where the build fails. Looks like the error is here
[91mconfigure: error: Cannot find FreeTDS in known installation directories
[0m
no
checking for PDO_DBLIB support via FreeTDS... yes, shared
Docker File
FROM php:5.6.30-apache
ENV DOWNLOAD_URL https://www.limesurvey.org/stable-release?download=2044:limesurvey2647%20170404targz
#php extensions
RUN docker-php-ext-install pdo pdo_mysql pdo_dblib pdo_pgsql \
&& apt-get update && apt-get install -y \
freetds-bin \
freetds-dev \
freetds-common \
libct4 \
libsybdb5 \
tdsodbc \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
libldap2-dev \
zlib1g-dev \
libc-client-dev \
libkrb5-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 \
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu \
&& docker-php-ext-install ldap \
&& docker-php-ext-install zip \
&& docker-php-ext-configure imap --with-imap-ssl --with-kerberos \
&& docker-php-ext-install imap \
&& rm -rf /var/lib/apt/lists/* \
#Download and install LimeSurvey
&& curl -SL "$DOWNLOAD_URL" -o /tmp/lime.tar.gz \
&& tar xf /tmp/lime.tar.gz limesurvey --strip-components=1 -C /var/www/html \
&& chown -R www-data:www-data /var/www/html \
&& rm -f /tmp/lime.tar.gz \
&& chmod -R 755 /var/www/html/tmp \
&& chmod -R 755 /var/www/html/upload \
&& chmod -R 755 /var/www/html/application/config \
&& mkdir -p /var/lib/php5 \
&& chown www-data:www-data /var/lib/php5
The image is using PHP 5.6.30. How can I get this to see the freetds installation?
You need to consider the correct installation order of dependent packages. Currently your RUN
command installs freetds-{bin,dev}
after the docker-php-ext-install pdo pdo_mysql pdo_dblib pdo_pgsql
command. If you turn around the order of installation steps, the freetds files will be found. Example snippet:
RUN apt-get update && apt-get install -y \
freetds-bin \
freetds-dev \
freetds-common \
libct4 \
libsybdb5 \
tdsodbc \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
libldap2-dev \
zlib1g-dev \
libc-client-dev \
...
&& docker-php-ext-install pdo pdo_mysql pdo_dblib pdo_pgsql \
...
That won't be enough, though. I got the following error:
configure: error: Could not find /usr/lib/libsybdb.a|so
You can find solutions to such issues via Google. In that special case you need to add a symlink as part of your RUN
command (found at https://github.com/phpbrew/phpbrew/issues/643#issuecomment-165447722):
ln -s /path/to/your/libsybdb.a /usr/lib/
Similar issues might arise while working through your Dockerfile.
For development I recommend to split the huge RUN
command into several dedicated RUN
commands so that you won't have to perform every step over and over again. When you're confident that the Dockerfile works, you can join the commands back into a single RUN
command.