Docker Ubuntu 18.04 unable to install msodbcsql17 SQL Server ODBC Driver 17

  docker, dockerfile, odbc, sql-server, ubuntu-18.04

I have the below ubuntu docker file to which I want to add SQL Server ODBC Driver 17 for installation. When I build the docker file, I am getting an error:
‘/bin/sh -c apt-get install msodbcsql17’ returned a non-zero code: 1

Could you please help?

I am referring to the article –

I followed the steps in the article in my Ubuntu VM and it works fine and I am able to run my python programs. However, when I use the docker file I get the error

FROM ubuntu:18.04

RUN apt update -y  &&  apt upgrade -y && apt-get update 
RUN apt install -y curl python3.7 git python3-pip openjdk-8-jdk unixodbc-dev

RUN curl | apt-key add -
RUN curl > /etc/apt/sources.list.d/mssql-release.list
RUN exit
#RUN ACCEPT_EULA=Y apt-get install msodbcsql17
RUN apt-get update
RUN apt-get install msodbcsql17
#RUN ACCEPT_EULA=Y apt install msodbcsql17
RUN ACCEPT_EULA=Y apt install mssql-tools
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc

RUN chmod +x /
ENTRYPOINT ["sh","/"]

Source: StackOverflow