sulu-docker
sulu-docker copied to clipboard
[Discussion] Change database to mariadb
At this time the mysql image does not support ARM processors. Or in other words, it does not work on the new M1 from Apple . I tested the set up on an M1 once with Maria DB. With Maria DB it works and seems to run the same way as with mysql.
So what do you think about changing the setup from mysql to maria db for supporting the ARM stack with no disadvantage for other machines.
Proposed solution
db:
image: mariadb:10.5.8
command: --default-authentication-plugin=mysql_native_password
ports:
- ${PORT_MYSQL}:3306
volumes:
- ./data/mysql:/var/lib/mysql
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
~~@TheCadien or switch to mysql/mysql-server that has ARM64 on the docker page which interestingly is a fork from the original docker-library/mysql sulu-docker uses.~~
EDIT:
Did not read the warning on the docker page.
Warning
The MySQL Docker images maintained by the MySQL team are built specifically for Linux platforms. Other platforms are not supported, and users using these MySQL Docker images on them are doing so at their own risk. See the discussion here for some known limitations for running these containers on non-Linux operating systems.
So Maria DB is a good option.
For reference, this is the issue regarding arm64 support for the official mysql
image: https://github.com/docker-library/mysql/issues/318
I do not have any experience with using mariadb
. But I am open to change this if there is no progress in https://github.com/docker-library/mysql/issues/318 in the next months 🙂
The only problem I see we are not official testing against mariadb and we recommend mysql in our docs and a comming guide. Does somebody know the inpact of the platform
flag:
Reference: https://stackoverflow.com/questions/65456814/docker-apple-silicon-m1-preview-mysql-no-matching-manifest-for-linux-arm64-v8#answer-65592942
Addition:
Think the problems here is in docker itself as Apple M1 is ARM but supports also x86_64 over its emulation layer, docker should fallback to the x86_64 if the ARM is not available, the platform flag seems to force that it will use the x86_64 image which Apple M1 does support. From the official docker docs: https://docs.docker.com/docker-for-mac/apple-m1/ they recommend --platform linux/amd64
for this images.
@TheCadien can you try this by adding the platform
flag. I don't have an M1 from Apple, so I cannot test it myself.
mysql:
platform: linux/x86_64
image: mysql:8.0.19
...
@mfehr94 It basically looks like it will work, I can definitely create a Docker container with it and access it. However, the container seems to be extremely slow. Doctrine even returns me only the following as an error.
`In AbstractMySQLDriver.php line 115:
An exception occurred in driver: SQLSTATE[HY000] [2006] MySQL server has gone away`
And like @alexander-schranz i'm not really sure what the plattform tag is.