Skip to content

Magento 2 – Configuring db in Docker context

Looking for build a magento docker container.
Is using mariadb:10.6 image for the database, but maybe lacking some property. Follows the service frm docker-compose.yaml created with ece-tools:

db:
hostname: db.magento2.docker
image: ‘mariadb:10.6’
shm_size: 2gb
environment:
– MYSQL_ROOT_PASSWORD=root
– MYSQL_DATABASE=magento2
– MYSQL_USER=root
– MYSQL_PASSWORD=root
ports:
– 3306:3306
volumes:
– ‘.docker/mnt:/mnt:rw,delegated’
– ‘/ect/mysql/mariadb.conf.d:/etc/mysql/mariadb.conf.d’
– ‘magento-db:/var/lib/mysql’
healthcheck:
test: ‘mysqladmin ping -h localhost -pmagento2’
interval: 30s
timeout: 30s
retries: 3
networks:
magento:
aliases:
– db.magento2.docker

The program mounts the volume in /etc/mysk/mariadb.conf.d well, but seems to ignore it.
have been aware about that on the app installation moment via ‘bin/magento setup:install’, when got the following back

root@HPCOREI5:~/magento# bin/magento setup:install -v
Starting Magento installation:
File permissions check…
[Progress: 1 / 1451]
Required extensions check…
[Progress: 2 / 1451]
Enabling Maintenance Mode…
[Progress: 3 / 1451]
Installing deployment configuration…
[Progress: 4 / 1451]
Installing database schema:

In Abstract.php line 148:

[Zend_Db_Adapter_Exception (2002)]
SQLSTATE[HY000] [2002] No such file or directory

Exception trace:
at /root/magento/vendor/magento/zend-
db/library/Zend/Db/Adapter/Pdo/Abstract.php:148
Zend_Db_Adapter_Pdo_Abstract->_connect() at
/root/magento/vendor/magento/zend-
db/library/Zend/Db/Adapter/Pdo/Mysql.php:111

i don’t found any mysql image
Thanks.