Image cannot connect to on-prem database

I ran into a problem with Docker and a .net core web api project. The database is on-prem and I cannot connect to it. The database is SQL server 20`4 on port 1433. In the docker run command I added p 1433:1433 and referred to the sql server connection string using the IP address and still cannot get connected. Has anyone worked through this problem and can guide me to a solution?