I am running Percona Server 5.6 inside of docker container and it works until I am trying to mount internal /var/lib/mysql volume to the host directory /home/me/data to provide persistence between container restarts:
docker run -v /home/me/data:/var/lib/mysql percona-sql:tag
The error log is as following:
ibdata1’ did not exist. A new tablespace will be created!
2016-03-17T21:08:02.056072Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2016-03-17T21:08:02.056080Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2016-03-17T21:08:02.056084Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2016-03-17T21:08:02.056088Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2016-03-17T21:08:02.056092Z 0 [ERROR] InnoDB: Cannot open datafile ‘./ibdata1’
2016-03-17T21:08:02.056096Z 0 [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!
2016-03-17T21:08:02.056101Z 0 [ERROR] InnoDB: InnoDB Database creation was aborted with error Cannot open a file. You may need to delete the ibdata1 file before trying to start up again.
2016-03-17T21:08:03.157029Z 0 [ERROR] Plugin ‘InnoDB’ init function returned error.
2016-03-17T21:08:03.157061Z 0 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.
2016-03-17T21:08:03.157071Z 0 [ERROR] Failed to initialize plugins.
2016-03-17T21:08:03.157091Z 0 [ERROR] Aborting
I don’t really understand the problem here: “mysqld” is running in container with root privilege. Why doesn’t it have access rights to the “/var/lib/mysql” folder if it’s mounted to host directory