title: How do I access my Azure SQL database (not in a container) from within a docker container
body: <p>I have a SQL Server running on docker. I'm trying to connect to it from a web app written in python3 with pymssql.</p>
  
  <p>It's working until I run the same app inside a docker container.</p>
  
  <p>I get this error:</p>
  
  <blockquote>
    <p>20002, b'DB-Lib error message 20002, severity 9:\nAdaptive Server connection failed (nameofmydb.database.windows.net:1433)\n'.</p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>pymssql.connect(server='mydb.database.windows.net', port='1433', database='mydb', user='user@server', password='pwd')
  </code></pre>
  
  <p>I tried with <code>--net=host</code> but it doesn't work either.</p>
  
  <p>Can someone help me, please?</p>
  
  <p>EDIT: So i finally succeeded after around 2 days , it was because of the installation of odbc driver in the container i was doing it in a wrong way.
  Also i was forced to use pyodbc yes.
  Install the odbc drivers + python the way azure tell you to in the docs and use pyodbc and not pymssql (which works outside of docker).</p>