Docker Community Forums

Share and learn in the Docker community.

Migrate issue on linuxserver/mariad container: "'Specified key was too long; max key length is 767 bytes"

Hi Docker support team,

I’m trying to run my django application with mariadb on the Raspberry Pi4 using docker compose.
I wanted to install mariadb (I installed mariadb on the Pi successfully without using docker before), but it says mariadb doesn’t support armv7 when I tried to pull mariadb image. So I used linuxserver/mariadb.


I built the image and created network and containers(django and db container) successfully. The containers are running without any issue.
However, I met the following error while migrating the db.

Through some googling, I knew the character encoding of the db should be set to utf8 to fix it.
In order to fix this issue, I tried two ways in the following link.

–The first way: Adding a command for utf-8 setting
In this case, my docker-compose.yml file is above.
However, this way didn’t work and I got the same error. Of course, I rebuilt the image and container before trying this.

  • -The second way: Mounting a custom cnf file as a volume

In this case, the docker-compose.yml file is above
In fact, I’m not sure if the declaration of the volume of the mycustom.cnf is correct. But if I add the volume for mycustom.cnf without any declaration, then I get an error.
The mycustom.cnf file is in the project root directory(docker-compose.yml file is also in the root directory).
Here is mycustom.cnf.
[mysqld]
character-set-server = utf8
collation-server = utf8_unicode_ci
skip-character-set-client-handshake

Anyway, the second way also didn’t work as well.
I tried several other ways to fix this issue, but they also didn’t work.

How can I fix this error? I’m struggling with this issue for three days.
I really hope you get back to me with the best solution as soon as possible.

Thanks in advance.
Anatoli.

Might be useful to include the info we ask for in the template.

Current Behavior

Steps to Reproduce

Environment

OS:
CPU architecture: x86_64/arm32/arm64
How docker service was installed:

Command used to create docker container (run/create/compose/screenshot)

Docker logs