The problem with
yes | dpkg -i package.deb
is that you can't exactly predict which prompts are going to be shown, depending on the package's and the hosting system's configuration; you might say yes
to something you didn't want to, or perhaps tell the system that your domain name or default database user is yes
. Debconf was designed to give you very detailed and, for the most part, very safe and robust control over package installation - use that power.
I had same problem with debian 10 image specifically for installing mssql client, I have solved this issue by setting:
ENV ACCEPT_EULA=Y
RUN dpkg --install msodbcsql18_18.2.1.1-1_amd64.deb &&
dpkg --install mssql-tools18_18.2.1.1-1_amd64.deb