On OS X.
I am trying to run mysql in a docker container through boot2docker, by mounting the volume /var/lib/mysql
on the host, so that I can have persistant mysql data.
I plan to use a data only container in future, but right now I was trying to do this using this option.
I use the following command to run the container :
docker run -v /Users/yash/summers/db:/var/lib/mysql -i -t 'image name'
The /Users/yash/summers/db
folder is already there.
I am facing persmission issues in this. Using commandline, I am able to access the directory, create/remove new files, but when I am running
service mysql start
, I get the following error:
150528 15:43:43 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150528 15:43:43 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
150528 15:43:43 [Note] /usr/sbin/mysqld (mysqld 5.5.43-0ubuntu0.14.04.1) starting as process 909 ...
150528 15:43:43 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
150528 15:43:43 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.150528 15:43:43 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
150528 15:43:43 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
150528 15:43:43 InnoDB: The InnoDB memory heap is disabled
150528 15:43:43 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150528 15:43:43 InnoDB: Compressed tables use zlib 1.2.8
150528 15:43:43 InnoDB: Using Linux native AIO
150528 15:43:43 InnoDB: Initializing buffer pool, size = 128.0M
150528 15:43:43 InnoDB: Completed initialization of buffer pool
150528 15:43:43 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
150528 15:43:44 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
I have trying to solve this for the past 2 days, going through so many pages like this, this, and this.
I can't solve my problem. I think I am not able to perfectly do what the solutions are suggesting.
From my understanding, there are some workarounds listed on those pages which include changing the uids and guids, but I think they are not well explained.
Can anybody please explain to me a detailed workaround for this.
Update 1 : I tried the it with using a data only container also, and still facing the same issue.
I am able to run everything fine if I don't use any -v
or --volumes-from
option, so I think there is no prob in mysql server.
Update 2 : Dockerfile used for creating the data-only container:
FROM ubuntu
RUN mkdir /var/lib/mysql
VOLUME /var/lib/mysql