craftcms / nitro

Speedy local dev environment for @craftcms.
https://getnitro.sh
MIT License
178 stars 24 forks source link

2.0.0-beta.1 mysql issue with M1 Macs #234

Closed dlindberg closed 3 years ago

dlindberg commented 3 years ago

Description

There is a know issue with Docker Apple M1 Tech Preview that unfortunately mysql images don't work. This will cause Nitro setup to fail Error: unable to create the container, Error response from daemon: No such image: mysql:8.0.

The release notes suggest using mariadb instead which I'm not seeing a straightforward to set that up after init. If possible, adding the option to select a mariadb image instead at setup should resolve the issue and create the option for dev testing where mariadb is currently used in production (a possible default option when setting up production servers using Laravel Forge) even for folks not running preview versions of docker.

The alternate solution is to force an Intel version to be used in emulation, --platform linux/amd64 but the mariadb solution seems like it should be more performant.

Steps to reproduce

  1. Run nitro init on an M1 machine
  2. Select any mysql version

Additional info

jasonmccallister commented 3 years ago

@dlindberg thank you for pointing that out, I suppose we could check if the runtime is on the M1 and prompt for mariadb instead. We just pushed some changes to our upstream docker images (https://github.com/craftcms/docker) to build ARM versions and the next beta of Nitro should have better support for the M1.

jasonmccallister commented 3 years ago

@dlindberg 2.0.0-beta.2 is out and includes an Arm variant of the craftcms/nitro-proxy image to better support the M1.

After upgrading, try nitro update to get the latest images from docker hub.

https://github.com/craftcms/nitro/blob/main/CHANGELOG-V2.md#200-beta2---2021-02-04

Also, mariadb is supported, but not the default as you pointed out: https://craftcms.com/docs/nitro/2.x/multiple-databases.html

jasonmccallister commented 3 years ago

Just manually added a binary to run the nitro command with native support here: https://github.com/craftcms/nitro/releases/tag/2.0.0-beta.2

dlindberg commented 3 years ago

Still double checking a couple things with my system, but looks like mysql still isn't happy. Going to setup a local db as mentioned in #233 in the interim. (Postgress does install quite happily, unfortunately my project is already mysql)

Updated nitro to nitro version 2.0.0-beta.2 and tried basic update which didn't work, then tried:

nitro destroy
rm -rf ~/.nitro
docker system prune
nitro init

still got:

Setting up Nitro…
Would you like to use MySQL [Y/n] y
Select the version of MySQL
  1. 8.0
  2. 5.7
  3. 5.6
Enter your selection: 1
Would you like to use PostgreSQL [Y/n] n
Would you like to use Redis [Y/n]
  … adding redis service ✓
Checking Nitro…
  … creating network
✓
  … pulling image ✓
  … creating volume ✓
  … creating proxy ✓
Checking network…
  ✓ network ready
Checking proxy…
  ✓ proxy ready
Checking databases…
  … checking mysql-8.0-3306.database.nitro   … downloading mysql:8.0 ✗
Error: unable to create the container, Error response from daemon: No such image: mysql:8.0
dlindberg commented 3 years ago

Looks like I miss read the instructions, yes that works for getting it setup with MariaDB.

jasonmccallister commented 3 years ago

The next beta will not default to mysql for users on M1 macs to avoid confusion

dlindberg commented 3 years ago

Thanks, this is shaping up to be an excellent update, hard to make a direct compare because I never tired the Multipass version on this system, but now that things are up and running it seems substantially smoother than version 1.

jasonmccallister commented 3 years ago

With 2.0.0-beta.3 we are suggesting mariadb instead of mysql to resolve this issue. The team running on M1s is reporting that things are working as inspected.

jasonmccallister commented 3 years ago

We just pushed beta.4 that will check for any Arm-based device and select database images appropriately. M1 support, and Arm, has been greatly improved. Going to close this out! Thank you for the report!

russback commented 2 years ago

I'm getting this mysql error with 2.0.8. Has there been a regression?

Checking databases…
  … checking mysql-8.0-3306.database.nitro   … downloading mysql:8.0 ✗
Error: unable to create the container, Error response from daemon: No such image: mysql:8.0

I didn't see an option for MariaDB in the init process.