Docker – LAMP Mariadb container fails to launch

Visits: 124

Here is the Log Information one of them:

xxx-xx-xx xx:xx:xx 3333333333 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
-xx-xx xx:xx:xx 3333333333 [ERROR] Plugin 'InnoDB' init function returned error.

For fixing set your volumes from mariadb with local driver.

version: '3'
services:
  php-apache:
    build:
      context: ./php-apache
    ports:
      - 80:80
    volumes:
      - ./www:/var/www/html
    links:
      - 'mariadb'

  mariadb:
    image: mariadb:10.1
    restart: always
    volumes:
      - mariadb:/var/lib/mysql
    environment:
      TZ: "Europe/Rome"
      MYSQL_ALLOW_EMPTY_PASSWORD: "no"
      MYSQL_ROOT_PASSWORD: "rootpwd"
      MYSQL_USER: 'testuser'
      MYSQL_PASSWORD: 'testpassword'
      MYSQL_DATABASE: 'testdb'

volumes:
  mariadb:
    driver: local