Reputation: 21
this is my docker-compose file
version: '3'
services:
djangoSql:
restart: always
network_mode: bridge
container_name: djangoSql
image: mysql
volumes:
- .:/code
environment:
MYSQL_DATABASE: test1
MYSQL_ROOT_PASSWORD: 1234
ports:
- 6044:3306
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
interval: 2s
timeout: 20s
retries: 10
web:
build: .
network_mode: bridge
volumes:
- .:/code
ports:
- "8000:8000"
image: django
environment:
WAIT_HOSTS: djangoSql:3306
WAIT_HOSTS_TIMEOUT: 300
WAIT_SLEEP_INTERVAL: 30
WAIT_HOST_CONNECT_TIMEOUT: 30
depends_on:
- djangoSql
links:
- djangoSql:mysql
this is my error
django.db.utils.OperationalError: (1045, 'Plugin caching_sha2_password could not be loaded: /usr//usr/lib/x86_64-linux-gnu/mariadb19/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory')
the url has two usr i don't know why
this is docker file
FROM python:3.7
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD ./wait-for-it.sh /code/wait-for-it.sh
ADD . /code/
CMD ["/code/wait-for-it.sh", "djangoSql:3306", "-t", "6000", "--`","python","manage.py", "runserver", "0.0.0.0:8000"]`
and this is requirement.txt
Django>=2.0,<3.0
djangorestframework
mysqlclient
tensorflow==1.15
setuptools>=41.0.0
pandas
Keras
Upvotes: 2
Views: 723
Reputation: 139
according to mysql official image you need to add this command to your mysql service in the compose file:
command: --default-authentication-plugin=mysql_native_password
and do not forget to create a new container of your mysql image after adding this command.
Upvotes: 2