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:
- How to disable ssl using
mariadb-dev
- Is there any other image that is more lightweight than ubuntu but allow me to use
libmysqlclient-dev
- Is there any other way to connect to my database with ssl disabled
Thank you in advance!