MariaDB / mariadb-docker

Docker Official Image packaging for MariaDB
https://mariadb.org
GNU General Public License v2.0
759 stars 438 forks source link

MariaDB IGNORES my environment variables #482

Closed DimitriDR closed 1 year ago

DimitriDR commented 1 year ago

Hello,

I spent hours to struggle with Nextcloud setup because MariaDB container doesn't allow connections from other hosts, but I found the real problem is that MariaDB completely ignores what I put in my Docker Compose.

version: "3.9"

services:
  db:
      image: mariadb:latest
      container_name: nextcloud-db
      restart: unless-stopped
      environment:
        - MARIADB_ROOT_HOST="%"
        - MARIADB_ROOT_PASSWORD=nextcloud
        - MARIADB_DATABASE=nextcloud
        - MARIADB_USER=nextcloud
        - MARIADB_PASSWORD=nextcloud
      volumes:
        - /nextcloud-db/:/var/lib/mysql
      networks:
        - nextcloud-network

  nextcloud:
    image: nextcloud
    container_name: nextcloud
    depends_on:
      - db
    links:
      - db
    ports:
      - 64246:80
    volumes:
      - /nextcloud/:/var/www/html
    networks:
      - nextcloud-network

networks:
  nextcloud-network:
    name: nextcloud-network
    driver: bridge

WHY?

When I do: SHOW DATABASES; I only have this:

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.000 sec)

It didn't created my database, I understand why I can't connect from any other containers despite the MYSQL_ROOT_HOST="%"

DimitriDR commented 1 year ago

Yeah, no. It works but It just took ages.

grooverdan commented 1 year ago

but It just took ages.

How long?

DimitriDR commented 1 year ago

Like 7-10 minutes. After 2 minutes, I thought It was buggy and I restarted and/or destroyed the container, leading to never wait until I did lol. MariaDB doesn't talk that much in the Docker logs, It doesn't say I'll do that, I finished that, etc.

grooverdan commented 1 year ago

If you still have the logs it might help me direct attention to some of the intervals to see what speedup can be done. A compressed initial datadir may be an option.

MARIADB_INITDB_SKIP_TZINFO=1 will save some time, but it used to be a small amount of IO.

DimitriDR commented 1 year ago

Sadly, I don't have them anymore. The problem wasn't the wait time but that I got very few information the container was effectively working.