Issue install msodbcsql17 on docker

Huhn, Alexander 105 Reputation points
2023-02-14T15:13:35.1966667+00:00

I have a docker and want to install odbc17 as per https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver16&tabs=alpine18-install%2Calpine17-install%2Cdebian8-install%2Credhat7-13-install%2Crhel7-offline

# Start with R/tidyverse

FROM rocker/verse

ENV DEBIAN_FRONTEND=noninteractive

#get python

RUN apt-get update && apt-get install -y --no-install-recommends build-essential libpq-dev python3.9 python3-pip python3-setuptools python3-dev

RUN pip3 install --upgrade pip

RUN apt -y install libpng-dev

# Install odbc

RUN sudo su

RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -

RUN curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list > /etc/apt/sources.list.d/mssql-release.list

RUN exit

RUN sudo apt-get update

RUN sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17

But while generating the image in Azure, I get the following error and it fails to generate:

2023-02-14T14:18:42.2710828Z (Reading database ... 64137 files and directories currently installed.)
2023-02-14T14:18:42.2734316Z Preparing to unpack .../libodbc1_2.3.11_amd64.deb ...
2023-02-14T14:18:42.2766375Z Unpacking libodbc1:amd64 (2.3.11) ...
2023-02-14T14:18:42.2807979Z dpkg: error processing archive /var/cache/apt/archives/libodbc1_2.3.11_amd64.deb (--unpack):
2023-02-14T14:18:42.2810054Z  trying to overwrite '/usr/lib/x86_64-linux-gnu/libodbc.so.2.0.0', which is also in package libodbc2:amd64 2.3.9-5
2023-02-14T14:18:42.2813123Z dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
2023-02-14T14:18:42.3056068Z Selecting previously unselected package odbcinst1debian2:amd64.
2023-02-14T14:18:42.3123163Z Preparing to unpack .../odbcinst1debian2_2.3.11_amd64.deb ...
2023-02-14T14:18:42.3152521Z Unpacking odbcinst1debian2:amd64 (2.3.11) ...
2023-02-14T14:18:42.3185590Z dpkg: error processing archive /var/cache/apt/archives/odbcinst1debian2_2.3.11_amd64.deb (--unpack):
2023-02-14T14:18:42.3186984Z  trying to overwrite '/usr/lib/x86_64-linux-gnu/libodbcinst.so.2.0.0', which is also in package libodbcinst2:amd64 2.3.9-5
2023-02-14T14:18:42.3198162Z dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
2023-02-14T14:18:42.3382063Z Selecting previously unselected package odbcinst.
2023-02-14T14:18:42.3472775Z Preparing to unpack .../odbcinst_2.3.11_amd64.deb ...
2023-02-14T14:18:42.3497953Z Unpacking odbcinst (2.3.11) ...
2023-02-14T14:18:42.3534885Z dpkg: error processing archive /var/cache/apt/archives/odbcinst_2.3.11_amd64.deb (--unpack):
2023-02-14T14:18:42.3536489Z  trying to overwrite '/etc/odbc.ini', which is also in package unixodbc-common 2.3.9-5
2023-02-14T14:18:42.3681417Z Selecting previously unselected package unixodbc.
2023-02-14T14:18:42.3752176Z Preparing to unpack .../unixodbc_2.3.11_amd64.deb ...
2023-02-14T14:18:42.3771226Z Unpacking unixodbc (2.3.11) ...
2023-02-14T14:18:42.4193006Z Selecting previously unselected package msodbcsql17.
2023-02-14T14:18:42.4238023Z Preparing to unpack .../msodbcsql17_17.10.2.1-1_amd64.deb ...
2023-02-14T14:18:42.5528924Z debconf: unable to initialize frontend: Dialog
2023-02-14T14:18:42.5529605Z debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
2023-02-14T14:18:42.5530149Z debconf: falling back to frontend: Readline
2023-02-14T14:18:42.6125811Z Unpacking msodbcsql17 (17.10.2.1-1) ...
2023-02-14T14:18:42.7364967Z Errors were encountered while processing:
2023-02-14T14:18:42.7365575Z  /var/cache/apt/archives/libodbc1_2.3.11_amd64.deb
2023-02-14T14:18:42.7366080Z  /var/cache/apt/archives/odbcinst1debian2_2.3.11_amd64.deb
2023-02-14T14:18:42.7369636Z  /var/cache/apt/archives/odbcinst_2.3.11_amd64.deb
2023-02-14T14:18:42.7495579Z W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/google-chrome.list:3 and /etc/apt/sources.list.d/google.list:1
2023-02-14T14:18:42.7496884Z W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/google-chrome.list:3 and /etc/apt/sources.list.d/google.list:1
2023-02-14T14:18:42.7498150Z E: Sub-process /usr/bin/dpkg returned an error code (1)
2023-02-14T14:18:42.9082238Z The command '/bin/sh -c sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17' returned a non-zero code: 100
2023-02-14T14:18:42.9188464Z ##[error]The command '/bin/sh -c sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17' returned a non-zero code: 100
2023-02-14T14:18:42.9249998Z ##[error]The process '/usr/bin/docker' failed with exit code 100
2023-02-14T14:18:42.9322417Z ##[section]Finishing: Build and push an image to container registry

It used to work a week ago

Is there anything that can be done so it works again. Any advice appreciated.

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,173 questions
{count} votes

Accepted answer
  1. VenkateshDodda-MSFT 24,951 Reputation points Microsoft Employee Moderator
    2023-02-15T09:38:01.81+00:00

    @Huhn, Alexander Thank you for reaching out to Microsoft Q&A, apologize for the inconvenience caused on this.

    Looking at the error message It appears you have some conflicts in the packages that are currently installed. You need to remove those conflicting packages to install msodbcsql17 and to create a image using docker.

    I have removed those conflicting packages in my docker file and updated the above docker file to below and tested in local machine (running with docker wsl2) able to build the image with any issues:

    Here is the updated docker file:

    FROM rocker/verse
    
    ENV DEBIAN_FRONTEND=noninteractive
    
    #get python
    
    RUN apt-get update && apt-get install -y --no-install-recommends build-essential libpq-dev python3.9 python3-pip python3-setuptools python3-dev
    
    RUN pip3 install --upgrade pip
    
    RUN apt -y install libpng-dev && apt install -y gnupg2
    
    # Install odbc
    
    RUN sudo su
    
    RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
    
    RUN curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list > /etc/apt/sources.list.d/mssql-release.list
    
    RUN exit
    
    RUN sudo apt-get update && apt install -y apt-utils
    
    RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
    
    RUN sudo apt-get remove -y libodbc2 libodbcinst2 odbcinst unixodbc-common
    
    RUN sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17
    
    

    **Here is the sample output for your reference : **

    enter image description here

    Feel Free to reach back to me if you have any further questions on this.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Huhn, Alexander 105 Reputation points
    2023-02-15T09:31:26.6033333+00:00

    @Nick Pondel , I updated to shiny-verse:4.2.1 and it solved this issue. Had to add a command to get curl as well, but everyhing built successfully

    FROM rocker/shiny-verse:4.2.1
    
    ENV DEBIAN_FRONTEND=noninteractive
    RUN apt-get -y update && apt-get -y install curl
    
    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.