title: Additional SQL Server db container in ddev setup beside web and db container
body: <p>I am playing around to get a additional SQL Server container (as multi db playground setup for TYPO3) in ddev configuartion within docker-compose.override.yaml.</p>
  <p>It works somehow and i can connect to the SQL Server from the host machine (to be honest with more luck than knowledge ;o).</p>
  <p>What i absolutely don't know is how to connect the new mssql container to the web container that TYPO3 can access it. Absolutely no clue ;o( Any ideas?</p>
  <p><strong>UPDATE:</strong>
  I had a little progress with my problem see below. It was simpler than expected. Ddev is building a additional MsSql Server container and TYPO3 can access it with an additional DB config.</p>
  <p>Don't know if this is a good practical way. Will investigate more if MsSql support in TYPO3 is useable.</p>
  <p><strong>docker-compose.override.yaml:</strong></p>
  <pre><code>version: '3.6'
  
  services:
    web:
      environment:
        - TYPO3_CONTEXT=Development/Ddev
      links:
        - mssql:mssql
  
    mssql:
      # https://hub.docker.com/_/microsoft-mssql-server
      image: &quot;mcr.microsoft.com/mssql/server&quot;
      volumes:
        - mssql-db-data:/var/opt/mssql/
      environment:
        SA_PASSWORD: &quot;MyPassword001&quot;
        ACCEPT_EULA: &quot;Y&quot;
      ports:
        - &quot;1433:1433&quot;
  volumes:
    mssql-db-data:
      driver: local
  </code></pre>
  <p><strong>DB Connections in LocalConfigurtion:</strong></p>
  <pre><code>    'DB' =&gt; [
          'Connections' =&gt; [
              'Default' =&gt; [
                  'charset'  =&gt; 'utf8',
                  'dbname'   =&gt; 'db',
                  'driver'   =&gt; 'mysqli',
                  'host'     =&gt; 'db',
                  'password' =&gt; 'db',
                  'port'     =&gt; 3306,
                  'user'     =&gt; 'db',            
              ],
              'MsSql' =&gt; [
                  'charset' =&gt; 'UTF-8',
                  'dbname' =&gt; 'master',
                  'driver' =&gt; 'sqlsrv',
                  'host' =&gt; 'mssql',
                  'password' =&gt; 'MyPassword001',
                  'port' =&gt; '1433',
                  'user' =&gt; 'SA',
              ],
          ],
          'TableMapping' =&gt; [
              'sys_log' =&gt; 'MsSql',
          ],
      ],
  </code></pre>
  <hr />
  <p><strong>Update 2:</strong></p>
  <p>Here is a little update see below.</p>
  <p><strong>docker-compose.mssql.yaml:</strong></p>
  <p>With this configuration i get in DDEV an mssql container.</p>
  <pre><code>version: '3.6'
  
  services:
    web:
      links:
        - mssql:mssql
  
    mssql:
      # https://hub.docker.com/_/microsoft-mssql-server
      image: &quot;mcr.microsoft.com/mssql/server&quot;
      volumes:
        - mssql-db-data:/var/opt/mssql/
      environment:
        SA_PASSWORD: &quot;MyPassword001&quot;
        ACCEPT_EULA: &quot;Y&quot;
      ports:
        - &quot;1433:1433&quot;
  volumes:
    mssql-db-data:
      driver: local
  </code></pre>
  <p><strong>web-build/Dockerfile:</strong></p>
  <p>The web container needs additional packages. This Dockerfile works for me quite well.
  This link has a more advanced solution:
  <a href="https://stackoverflow.com/questions/58086933/how-to-install-the-sql-server-php-drivers-in-ddev-local#new-answer">How to install the SQL Server PHP drivers in DDEV-Local?</a></p>
  <pre><code># https://ddev.readthedocs.io/en/stable/users/extend/customizing-images/#adding-extra-dockerfiles-for-webimage-and-dbimage
  # https://stackoverflow.com/questions/58086933/how-to-install-the-sql-server-php-drivers-in-ddev-local#new-answer
  ARG BASE_IMAGE
  FROM $BASE_IMAGE
  
  RUN curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
  RUN curl https://packages.microsoft.com/config/debian/10/prod.list &gt; /etc/apt/sources.list.d/mssql-release.list
  
  RUN apt-get update
  RUN apt-get --allow-downgrades -y install libssl1.1=1.1.1d-0+deb10u5
  RUN apt-get -y update &amp;&amp; yes | ACCEPT_EULA=Y apt-get -y install php7.4-dev php-pear unixodbc-dev htop
  RUN ACCEPT_EULA=Y apt-get -y install msodbcsql17 mssql-tools
  RUN sudo pecl channel-update pecl.php.net
  RUN sudo pecl install sqlsrv
  RUN sudo pecl install pdo_sqlsrv
  
  RUN sudo printf &quot;; priority=20\nextension=sqlsrv.so\n&quot; &gt; /etc/php/7.3/mods-available/sqlsrv.ini
  RUN sudo printf &quot;; priority=30\nextension=pdo_sqlsrv.so\n&quot; &gt; /etc/php/7.3/mods-available/pdo_sqlsrv.ini
  RUN sudo phpenmod -v 7.3 -s cli sqlsrv pdo_sqlsrv
  RUN sudo phpenmod -v 7.3 -s fpm sqlsrv pdo_sqlsrv
  RUN sudo phpenmod -v 7.3 -s apache2 sqlsrv pdo_sqlsrv
  
  RUN sudo printf &quot;; priority=20\nextension=sqlsrv.so\n&quot; &gt; /etc/php/7.4/mods-available/sqlsrv.ini
  RUN sudo printf &quot;; priority=30\nextension=pdo_sqlsrv.so\n&quot; &gt; /etc/php/7.4/mods-available/pdo_sqlsrv.ini
  RUN sudo phpenmod -v 7.4 -s cli sqlsrv pdo_sqlsrv
  RUN sudo phpenmod -v 7.4 -s fpm sqlsrv pdo_sqlsrv
  RUN sudo phpenmod -v 7.4 -s apache2 sqlsrv pdo_sqlsrv
  
  RUN echo 'export PATH=&quot;$PATH:/opt/mssql-tools/bin&quot;' &gt;&gt; ~/.bash_profile
  
  </code></pre>