Docker certificate verification issue while installing ODBC driver

Viewed 42

FROM python:3.9.13-slim-buster

WORKDIR /home/app

RUN apt-get update
&& apt-get install --reinstall ca-certificates
&& apt-get install -y gnupg2 unixodbc-dev g++ curl

RUN curl -O http://pkg.jenkins-ci.org/debian-rc/jenkins-ci.org.key

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

RUN curl -k https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list

RUN curl -k https://packages.microsoft.com/debian/9/prod/pool/main/m/msodbcsql18/msodbcsql18_18.0.1.1-1_amd64.deb

RUN apt-get -f install unixodbc

RUN apt-get install ca-certificates

RUN apt-get update && ACCEPT_EULA=Y apt-get install -y msodbcsql18 mssql-tools

The above is part of my docker file for the django app. I am getting the following error while creating an image.

"RUN apt-get update && ACCEPT_EULA=Y apt-get install -y msodbcsql18_18.1.1.1 mssql-tools: #12 10.74 Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification. [IP: 104.214.230.139 443] #12 10.75 Reading package lists... #12 11.42 E: The repository 'https://packages.microsoft.com/debian/11/prod bullseye Release' does not have a Release file.

executor failed running [/bin/sh -c apt-get update && ACCEPT_EULA=Y apt-get install -y msodbcsql18_18.1.1.1 mssql-tools]: exit code: 100"

Please help.

1 Answers

To make this work on your own network, you'll need to add the CA from your local security appliance into your container:

sudo cp ca.pem /usr/local/share/ca-certificates/my-ca.crt
sudo update-ca-certificates
Related