Open yuriyzinchenko opened 8 years ago
@yuriyzinchenko are you looking for a Docker image with the PHP Driver for SQL Server and its pre-requisites installed?
@meet-bhagdev Yes. Or may be it's exists already?
@yuriyzinchenko @meet-bhagdev I created this Dockerfile. it might work.
The only problem I have is that is returning pdo_sqlsrv_db_handle_factory: Unknown exception caught
. I'm using that Dockerfile with a silex application and Doctrine DBA. it looks like that I'm not the only one wit that problem #161
@danielnv18 based on your file, I created my own Dockerfile. I add few instructions to avoid pdo_sqlsrv_db_handle_factory: Unknown exception.
RUN apt-get install -y locales \
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
&& locale-gen
It seems like with the encoding problem was the cause of connection failure
The docker image is available on the https://hub.docker.com/ nitra/php:php-7mssql
Full text of Dockerfile:
FROM nitra/php:php7
RUN printf "\n" | pecl install apcu
RUN docker-php-ext-enable apcu
# install the PHP extensions we need
RUN apt-get update && apt-get install -y locales unixodbc libgss3 odbcinst devscripts debhelper dh-exec dh-autoreconf libreadline-dev libltdl-dev unixodbc-dev wget unzip \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-install pdo opcache \
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
# Compile odbc_config
RUN cd /usr/local/src/ && dget -ux http://http.debian.net/debian/pool/main/u/unixodbc/unixodbc_2.3.1-3.dsc \
&& cd unixodbc-2.3.1/ && apt-get update && dpkg-buildpackage -uc -d -us -B && cp ./exe/odbc_config /usr/local/bin/
## Microsoft ODBC Driver 13 for Linux
RUN cd /usr/local/src/ \
&& wget https://download.microsoft.com/download/2/E/5/2E58F097-805C-4AB8-9FC6-71288AB4409D/msodbcsql-13.0.0.0.tar.gz \
&& tar xf msodbcsql-13.0.0.0.tar.gz && cd msodbcsql-13.0.0.0/ \
&& ldd lib64/libmsodbcsql-13.0.so.0.0; echo "RET=$?" \
&& sed -i 's/$(uname -p)/"x86_64"/g' ./install.sh \
&& ./install.sh install --force --accept-license
#
RUN cd /tmp && wget https://github.com/Microsoft/msphpsql/releases/download/v4.0.5-Linux/Ubuntu15.zip \
&& unzip Ubuntu15.zip \
&& mv -v Ubuntu15/* /usr/local/lib/php/extensions/no-debug-non-zts-20151012/ \
&& rm /usr/local/lib/php/extensions/no-debug-non-zts-20151012/signature \
&& rm -rf /tmp/*
RUN echo "extension=php_sqlsrv_7_nts.so" >> /usr/local/etc/php/conf.d/sqlsvr.ini \
&& echo "extension=php_pdo_sqlsrv_7_nts.so" >> /usr/local/etc/php/conf.d/sqlsvr.ini \
&& locale-gen
CMD ["php-fpm", "-F"]
EXPOSE 9000
Thanks @yuriyzinchenko. That did the trick for that particular error.
@danielnv18 @yuriyzinchenko super cool. I will try out your docker image and let you know how it goes. If everything looks good, I will start evangelizing it.
We will also add the following to our getting started instructions.
RUN apt-get install -y locales \
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
&& locale-gen
msodbcsql-13.0.0.0.tar.gz is not available anymore at the URL provided. Here is the current wget with correct URL
wget "https://meetsstorenew.blob.core.windows.net/contianerhd/Ubuntu%2013.0%20Tar/msodbcsql-13.0.0.0.tar.gz?st=2016-10-18T17%3A29%3A00Z&se=2022-10-19T17%3A29%3A00Z&sp=rl&sv=2015-04-05&sr=b&sig=cDwPfrouVeIQf0vi%2BnKt%2BzX8Z8caIYvRCmicDL5oknY%3D" -O msodbcsql-13.0.0.0.tar.gz
@yuriyzinchenko @vanomak, @meet-bhagdev and I have created a Docker image with the latest PHP drivers. Check it out here mssql-docker/php-mssql. This is also available on DockerHub under lbosqmsft/php-mssql
. Let us know what you think!
Great! What about php 7.1? And may be use official php image as the base?
Here you have another Docker image I have created that includes mssql driver. Hope it will be helpful for you francarmona/docker-ubuntu16-apache2-php7-mssql_client. DockerHub: francarmona/docker-ubuntu16-apache2-php7-mssql_client
I make this one under centos 7 and php 7.1.1. It also include soap for Exchange Webservices and ldap for autentifications. This is also available on DockerHub under reynier3mil/centos-php-fpm-msphpsql.
@sirio3mil @francarmona @yuriyzinchenko @vanomak @danielnv18: We are working on a Docker image for developers looking to use PHP Drivers for SQL Server in a Docker setup and publish it on DockerHub here: https://hub.docker.com/r/microsoft/. We would like to get your feedback on what we should name it. Can you take this survey and let us know what you think? https://www.surveymonkey.com/r/ZW3G6LV
mssql-php +1
Edited: I also voted in the survey
mssql-php +1
sqlsrv-php, cuz sqlsrv is the Microsoft driver's name, mssql is the name of the old and obsolete non Microsoft connector for PHP, not even included in PHP 7.
@danielnv18 @francarmona @sirio3mil We uploaded a newer version of this image here: https://hub.docker.com/r/lbosqmsft/mssql-php-msphpsql/
Please let me know if there's any feedback
@LuisBosquez I'd like to see the related Dockerfile
but the link seems dead.
The new repo for php dev env for SQLServer seems to be this one
@LuisBosquez I'd really like to see that image coming from a Microsoft official account on docker hub instead of your personal account. In addition it would be even better if it extended an official PHP base image instead of a bare Ubuntu one.
@Glideh @eseyden I can work with Luis on this. We can definitely get them published to the official Microsoft account
@meet-bhagdev Thank you! It was a little disconcerting being linked out to a personal github and dockerhub page from official documentation. Based on the contents of @LuisBosquez 's Dockerfile I was able to get the drivers working on the php:7-fpm image I use for our Laravel apps. If anyone is interested here is the Dockerfile I ended up with. https://gist.github.com/eseyden/9467bca6102666c823e20e9536e7b764
Thanks again for all the great work on improving the sqlsrv driver experience on php and linux.
Do you plan to create a docker image?