вторник, 23 апреля 2024 г.

Docker PHP/MSSQL/APACHE

 Nova days many systems and solutions based on Docker. Sometime main issue is collaborating several solutions into one docker-file for running it.

My situation was similar and required to deploy solution which us using SQL Server PHP and Apache, unusual case :) Thats why was decided to implement two docker containers where in first will be executed SQL Server and on second PHP/Apache.

Below you can find steps:

1) Install Docker in your linux system.

    yum install docker 

2) Install SQL Server container into your docker system

    sudo docker pull mcr.microsoft.com/mssql/server:2022-latest

 

3) Need to create docker-file (nano Dockerfile.base in /usr/src)

FROM php:8.2-apache-buster

RUN apt update && apt install -y unixodbc-dev gpg libzip-dev \
 && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
 && curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list \
 && apt update \
 && ACCEPT_EULA=Y apt-get install -y msodbcsql18 \
 && pecl install sqlsrv \
 && pecl install pdo_sqlsrv \
 && docker-php-ext-install pdo opcache bcmath zip \
 && mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
 && echo 'extension=sqlsrv.so' >> "$PHP_INI_DIR/php.ini" \
 && echo 'extension=pdo_sqlsrv.so' >> "$PHP_INI_DIR/php.ini" \
 && a2enmod rewrite

 -------------------------------------------------------------------------------------

For building new container from your docker file need to use below command 

 docker build . -f Dockerfile.base -t 3cp-web 

 

Комментариев нет:

Отправить комментарий

Общее·количество·просмотров·страницы