Certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)

Issue type:

certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)

Docker and Docker-Compose version

Install Docker Desktop on Windows

docker --version

Docker version 24.0.7, build afdd53b

Install Compose standalone

docker-compose --version

Docker Compose version v2.23.0

Issue Description
  • Dockerizing a Python application to run on Windows Server 2019 involves installing Docker and Docker Compose on the server.
  • Getting SSL certificate error since we are not using any private certificate for database connection.
  • The database in use is MS SQL 2017, and ODBC drivers are employed for accessing ODBC databases.
Docker Code

docker-compose.yml:

version: '3.8'
services:
  my-app:  
    build:
      context: . 
      dockerfile: Dockerfile
    env_file:
      - .env

Dockerfile:

# Use the official Microsoft Windows Server Core image with Python 3.9
FROM python:3.9-windowsservercore

# Set the working directory
WORKDIR /app

# Download and install MS SQL 2017 ODBC Driver
CMD ["cmd.exe", "curl https://go.microsoft.com/fwlink/?linkid=2249004"]
CMD ["cmd.exe", "msiexec", "/i", "msodbcsql.msi", "ADDLOCAL=ALL"]

# Copy just the requirements file
COPY requirements.txt requirements.txt

# Install the dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the current directory contents into the container at /app
COPY . /app

# Run the application
CMD ["python", "sms_main.py"]

Don’t use old

docker-compose --version

but new

docker compose --version

The question contains the compose version which is v2. Docker Desktop uses docker-compose as an alias to docker compose.

Although it is an old question and I assume you already solved it, but since the topic came up again, I have to note that Docker Desktop is not supported on Windows server. I don’t know what gave you the SSL error, but based on the second note in the issue description I guess the database itself. So it seems to be an MSSQL database setting/connection issue which I don’t know much about. Sharing the code that wants to connect would have helped more and a correct topic category, as the community is for asking “about” the community and people will not search for technical issues there. I fix the category.