【发布时间】:2021-01-29 19:11:46
【问题描述】:
我正在尝试 dockerise 我的 Django 应用程序。
docker-compose.yml
version: "3.8"
services:
db:
image: mysql:8
command: --default-authentication-plugin=mysql_native_password # this is not working
restart: always
environment:
MYSQL_ROOT_PASSWORD: rootmypass
ports:
- '3306:3306'
cache:
image: redis
environment:
REDIS_HOST: localhost
REDIS_PORT: 6379
ports:
- '6379:6379'
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db
- cache
当我运行docker-compose -up 时,我收到以下错误。
django.db.utils.OperationalError: (1156, 'Plugin caching_sha2_password could not be loaded: /usr/lib/x86_64-linux-gnu/mariadb19/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory')
经过搜索,我发现解决方案是使用command: --default-authentication-plugin=mysql_native_password 或降级mysql。尝试了第一个命令,但它不起作用。我也不想降级。
如何让它工作?
其他详情:
- 在 Windows 上使用 Docker。
- 发行版:Ubuntu 20.04 LTS (WSL2)。
- 连接器:mysqlclient==1.4.6。
【问题讨论】:
-
您运行 Web 容器的发行版是什么?这个容器中安装了哪些 mariadb-client 库?
-
@danblack,已更新。这里我也有点疑惑,为什么指定的图片是mysql的时候显示mariadb19。
-
mariadb19,来自 Ubuntu 焦点提供的客户端库集合 - packages.ubuntu.com/focal/amd64/libmariadb3/filelist 是包。 Debian 最近修复了这个问题 - bugs.debian.org/cgi-bin/bugreport.cgi?bug=962597。这在 MariaDB-10.3 中可用,但是应该提出一个 ubuntu 错误来包含它。
-
发现问题@danblack,我用的是ctrl+c而不是
docker-compose -down。