Mac M1: connect to local SQL server

Dear Python community,

I run the following code in Python on mac M1:

import pyodbc
server = 'localhost' 
username = 'sa' 
password = 'password' 
database = 'Fin_Data_TST' 
db_connection_string = "Driver={ODBC Driver 18 for SQL Server};Server=" + server + ";Database=" + database + ";UID=" + username + ";PWD=" + password + ";"
conn = pyodbc.connect(db_connection_string, autocommit=True)

I receive an error: pyodbc.OperationalError: (‘HYT00’, ‘[HYT00] [Microsoft][ODBC Driver 18 for SQL Server]Login timeout expired (0) (SQLDriverConnect)’)

I run a SQL server in docker on the same mac device with image = Microsoft Artifact Registry

How can I debug this error? It seems that I don’t receive a connection request when I check the SQL logs. I ran

drivers = pyodbc.drivers()
for d in drivers:
    print(d)

to check if I have the correct drivers. I also tried different names for server variable, adding the IP adres, port, changing ODBC driver to 17, …

If you have any questions, please shoot!

Thanks in advance!

Nigel