Docker Community Forums

Share and learn in the Docker community.

ERROR 2005 (HY000): Unknown MySQL server host 'db' (-2)

Description
Hello, Yesterday all work, ia have a image with magento 2, a image of GitHub - markshust/docker-magento: Mark Shust's Docker Configuration for Magento but today the container my_project_db_1 not work and show ERROR 2005 (HY000): Unknown MySQL server host ‘db’ (-2) were run command bin/mysql

Steps To Reproduce

  1. docker-compose start

Expected Result
all containers working but _db_1 not work

Actual Result
with command bin/mysql ERROR 2005 (HY000): Unknown MySQL server host ‘db’ (-2)

bin/restart done done done donde done done [ERROR] ENOSPC: System limit for number of file watchers reached, watch ‘/var/www/html/vendor/magento/module-asynchronous-operations’

In the documentation you pointed to, the example" mysql --host=[INSTANCE_IP] --user=root --password is to imply that the “[INSTANCE_IP]” should be substituted for the IP of your MySQL instance. However, in the snippets above it appears, you may have substituted only the inner content of the braces (i.e. [10.0.0.1]), so try re-running your commands without the braces around your IP:

mysql --host=10.0.0.1 --user=root --password

the problem is not initialized the mysql.
now, i create a new container with docker image of GitHub - markshust/docker-magento: Mark Shust's Docker Configuration for Magento but show this error.

$ bin/magento app:config:import
OCI runtime exec failed: exec failed: container_linux.go:367: starting container process caused: exec: “bin/magento”: stat bin/magento: no such file or directory: unknown
ERROR: 126