Search code examples
mysqlmacosdockerdocker-composedocker-desktop

macOS - Dockerize MySQL service connection refused, crashes upon use


Using mysql(v8.0.21) image with mac docker-desktop (v4.2.0, Docker-Engine v20.10.10)

As soon service up:

  • entrypoints ready
  • innoDB initialization done
  • ready for connection

But as soon try to run the direct script(query) it crashes, refused to connect (also from phpmyadmin) and restarted again.

  1. terminal log
  2. connection refused for phpMyAdmin

In the logs we are able to see an Error:

[ERROR] [MY-011947] [InnoDB] Cannot open '/var/lib/mysql/ib_buffer_pool' for reading: No such file or directory

The error we are able to see into log is not an issue, as it is fixed and updated by InnoDB already, here is the reference below:

https://jira.mariadb.org/browse/MDEV-11840


Note: docker-compose file we are pretty much sure that, there is no error as same is working fine for windows as well ubuntu, but the issue is only for macOS.


Solution

  • Thanks @NicoHaase and @Patrick for going through the question and suggestions.

    Found the reason for connection refused and crashing, posting answer so that it maybe helpful for others.

    It was actually due to docker-desktop macOS client there was by default 2GB Memory was allocated as Resource, and for our scenario it was required more than that.

    We just allocate more memory according to our requirement and it was just started working perfectly fine.

    For resource allocation:

    • open docker-desktop preferences
    • resources > advanced docker-desktop resources allocation