0

I'm trying to create a Django app using docker. Because of some problem, I want to connect with database without using ssl/tls. When I use local environment, or docker image ubuntu, it work fine when I adding these code under DATABASES in settings.py

'OPTIONS': {
    'ssl_mode': 'DISABLED',
},

But when I swap using python-alpine (because image ubuntu is too big), it return an error

django.db.utils.NotSupportedError: MySQL client library does not support ssl_mode specification

Here is my Dockerfile

FROM python:3.10-alpine

WORKDIR /app

# Install system dependencies
RUN apk update && apk add gcc musl-dev python3-dev libffi-dev openssl-dev mariadb-dev

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

As I know, the problem is on the connector. When I use ubuntu image, the connector is libmysqlclient-dev, but in alpine it is mariadb-dev, which not allow ssl_mode option.

So the question is:

  1. How to disable ssl using mariadb-dev
  2. Is there any other image that is more lightweight than ubuntu but allow me to use libmysqlclient-dev
  3. Is there any other way to connect to my database with ssl disabled

Thank you in advance!

0 Answers0