Topic Type: Question related to docker deployment.
Problem: Permission issue, mysql to access local storage.
The system is Linux Centos 7 in VM. Updated system with docker 18.09.3, using root.
I want to deploy container: wordpress and mysql with storage in local.
The docker-compose.yml:
version: '3.7'
services:
db-mysql:
image: mysql:5.7
user: 999:999
privileged: true
command: "--skip-grant-tables"
volumes:
- /data:/var/lib/mysql
restart: always
ports:
- 3306:3306
environment:
- MYSQL_ROOT_PASSWORD:Root123
- MYSQL_DATABASE:shift-db
- MYSQL_USER:mysql
- MYSQL_PASSWORD:mySql123
networks:
- wordpress-net
wordpress:
depends_on:
- db-mysql
image: wordpress
restart: always
ports:
- 8080:80
environment:
- WORDPRESS_DB_HOST:db-mysql
- WORDPRESS_DB_USER:mysql
- WORDPRESS_DB_PASSWORD:mySql123
- WORDPRESS_DB_NAME:shift-db
networks:
- wordpress-net
networks:
wordpress-net:
volumes:
data:
driver: local
I receive error in mysql container:
db-mysql_1 | 2019-03-18T10:20:15.733850Z 0 [Warning] Can’t open and lock time zone table: Table ‘mysql.time_zone_leap_second’ doesn’t exist trying to live without them
db-mysql_1 | 2019-03-18T10:20:15.734107Z 0 [ERROR] Can’t open and lock privilege tables: Table ‘mysql.servers’ doesn’t exist
db-mysql_1 | 2019-03-18T10:20:15.734374Z 0 [ERROR] Native table ‘performance_schema’.‘cond_instances’ has the wrong structure
[And more ERROR] with same ‘wrong structure’
I use privileged: true & command: “–skip-grant-tables”, becaue if not I got infinite reboot with error:
db-mysql_1 | 2019-03-18T10:24:13.183102Z 0 [ERROR] Fatal error: Can’t open and lock privilege tables: Table ‘mysql.user’ doesn’t exist
db-mysql_1 | 2019-03-18T10:24:13.183134Z 0 [ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
db-mysql_1 | 2019-03-18T10:24:13.183276Z 0 [ERROR] Aborting
I also already done # chmod -R 777 /data & # chown -r mysql:mysql /data