Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Percona container only runs the first time. #35

Closed
phpguru opened this issue Dec 1, 2016 · 12 comments
Closed

Percona container only runs the first time. #35

phpguru opened this issue Dec 1, 2016 · 12 comments
Labels
question Usability question, not directly related to an error with the image

Comments

@phpguru
Copy link

phpguru commented Dec 1, 2016

I'm on Windows 10, Docker 1.12.3 (8488) using the percona:latest image:tag.

I followed the strategy to keep the DB files on the host machine.

First time I run the container:

docker run -d -e APP=db -v /C/Users/myuser/mysql_data:/var/lib/mysql -e \
MYSQL_ROOT_PASSWORD=pass -e MYSQL_DATABASE=db \
-e MYSQL_USERNAME=user -e MYSQL_PASSWORD=pass \
--name=db -p 3306:3306 percona:latest

Awesome, up and running in a jiffy! Super excellent. IBDATA files got created in mysql_data directory as expected.

I work all day, go home and fire it up the next day, to see the container achieved Exited state only.

docker logs 

says

[ERROR] --initialize specified but the data directory has files in it. Aborting.

So, what should my docker run command look like on runs 2-N ? Or am I missing something obvious? The documentation is so great, I'm surprised I'm having any issues. Particularly this part (under Environment Variables):

if you start the container with a data directory that already contains a database: 
any pre-existing database will always be left untouched on container startup
@yosifkit
Copy link
Member

yosifkit commented Dec 2, 2016

I am unable to reproduce it here (running all on Linux). Are you sure the directory was correctly filled with a real database or is this related to #36?

$ docker run -d -e MYSQL_ROOT_PASSWORD=pass -e MYSQL_DATABASE=db \
-e MYSQL_USERNAME=user -e MYSQL_PASSWORD=pass \
-v "$PWD"/mysql:/var/lib/mysql --name db percona:5.7
10ebe77ca291ba5588d59fdb95aa304b27d03dc1c3ec347112c99172fff8ca1f
$ ls -l mysql/
total 176192
-rw-r----- 1 999 999       56 Dec  1 16:03 auto.cnf
-rw------- 1 999 999     1676 Dec  1 16:03 ca-key.pem
-rw-r--r-- 1 999 999     1083 Dec  1 16:03 ca.pem
-rw-r--r-- 1 999 999     1087 Dec  1 16:03 client-cert.pem
-rw------- 1 999 999     1680 Dec  1 16:03 client-key.pem
drwxr-s--- 2 999 999     4096 Dec  1 16:03 db
-rw-r----- 1 999 999      427 Dec  1 16:20 ib_buffer_pool
-rw-r----- 1 999 999 79691776 Dec  1 16:20 ibdata1
-rw-r----- 1 999 999 50331648 Dec  1 16:20 ib_logfile0
-rw-r----- 1 999 999 50331648 Dec  1 16:03 ib_logfile1
drwxr-s--- 2 999 999     4096 Dec  1 16:03 mysql
drwxr-s--- 2 999 999     4096 Dec  1 16:03 performance_schema
-rw------- 1 999 999     1680 Dec  1 16:03 private_key.pem
-rw-r--r-- 1 999 999      452 Dec  1 16:03 public_key.pem
-rw-r--r-- 1 999 999     1087 Dec  1 16:03 server-cert.pem
-rw------- 1 999 999     1676 Dec  1 16:03 server-key.pem
drwxr-s--- 2 999 999    12288 Dec  1 16:03 sys
$ docker stop db
db
$ docker rm db
db
$ docker run -v "$PWD"/mysql:/var/lib/mysql --name db percona:5.7
$ docker logs db
...
2016-12-02T00:33:53.339744Z 0 [Note] mysqld: ready for connections.
Version: '5.7.16-10'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  Percona Server (GPL), Release '10', Revision 'a0c7d0d'

@kersten
Copy link

kersten commented Apr 28, 2017

i have the exact same problem.

@yosifkit
Copy link
Member

@kersten I still cannot reproduce; any information you can give on your setup to help reproduce and debug?

This time I tested on Windows 10 using Docker 17.04.0-ce, docker-toolbox install, so using boot2docker, and VirtualBox with the shared Users folder to the VM. Used basically the same steps as I outlined above (even just stopping and starting the same container worked for me).

@troy-rudolph
Copy link

troy-rudolph commented Jan 5, 2018

I have precisely this same problem on Windows 10 with Docker for Windows 10.

I started things up yesterday and it worked great. Shut it down before going on to something else. Started it up again this afternoon. The DB server fails as shown below. Hope this helps. Thank you.

manager_mysql | 2018-01-05T23:09:55.733529Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
manager_mysql | 2018-01-05T23:09:55.733564Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
manager_mysql | 2018-01-05T23:09:55.737694Z 0 [Note] mysqld (mysqld 5.7.20-19) starting as process 1 ...
manager_mysql | 2018-01-05T23:09:55.756314Z 0 [Note] InnoDB: PUNCH HOLE support available
manager_mysql | 2018-01-05T23:09:55.756373Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
manager_mysql | 2018-01-05T23:09:55.756378Z 0 [Note] InnoDB: Uses event mutexes
manager_mysql | 2018-01-05T23:09:55.756381Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
manager_mysql | 2018-01-05T23:09:55.756385Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
manager_mysql | 2018-01-05T23:09:55.756388Z 0 [Note] InnoDB: Using Linux native AIO
manager_mysql | 2018-01-05T23:09:55.756959Z 0 [Note] InnoDB: Number of pools: 1
manager_mysql | 2018-01-05T23:09:55.757038Z 0 [Note] InnoDB: Using CPU crc32 instructions
manager_mysql | 2018-01-05T23:09:55.759833Z 0 [Note] InnoDB: Initializing buffer pool, total size = 384M, instances = 1, chunk size = 128M
manager_mysql | 2018-01-05T23:09:55.770296Z 0 [Note] InnoDB: Completed initialization of buffer pool
manager_mysql | 2018-01-05T23:09:55.774424Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
manager_mysql | 2018-01-05T23:09:55.799061Z 0 [Note] InnoDB: Crash recovery did not find the parallel doublewrite buffer at /var/lib/mysql/xb_doublewrite
manager_mysql | 2018-01-05T23:09:55.811047Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
manager_mysql | 2018-01-05T23:09:55.818994Z 0 [Warning] InnoDB: Retry attempts for writing partial data failed.
manager_mysql | 2018-01-05T23:09:55.819030Z 0 [ERROR] InnoDB: Write to file /var/lib/mysql/xb_doublewritefailed at offset 0, 1048576 bytes should have been written, only 0 were written. Operating system error number 22. Check that your OS and file system support files of this size. Check also that the disk is not full or a disk quota exceeded.
manager_mysql | 2018-01-05T23:09:55.819041Z 0 [ERROR] InnoDB: Error number 22 means 'Invalid argument'
manager_mysql | 2018-01-05T23:09:55.819046Z 0 [Note] InnoDB: Some operating system error numbers are described at http://dev.mysql.com/doc/refman/5.7/en/operating-system-error-codes.html
manager_mysql | 2018-01-05T23:09:55.830682Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
manager_mysql | 2018-01-05T23:10:00.939703Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
manager_mysql | 2018-01-05T23:10:00.939748Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
manager_mysql | 2018-01-05T23:10:00.939754Z 0 [ERROR] Failed to initialize plugins.
manager_mysql | 2018-01-05T23:10:00.939756Z 0 [ERROR] Aborting
manager_mysql |
manager_mysql | 2018-01-05T23:10:00.939761Z 0 [Note] Binlog end
manager_mysql | 2018-01-05T23:10:00.939829Z 0 [Note] Shutting down plugin 'CSV'
manager_mysql | 2018-01-05T23:10:00.939846Z 0 [Note] Shutting down plugin 'MyISAM'
manager_mysql | 2018-01-05T23:10:00.942115Z 0 [Note] mysqld: Shutdown complete
manager_mysql |
manager_mysql exited with code 1

@conflicker
Copy link

I'm having the same problem. Any possible work around for this?

@troy-rudolph
Copy link

In my environment, downgrading from Percona 5.7 to 5.6 solved the problem.

@qedrakmar
Copy link

I cannot reproduce this problem, either by starting a new container pointing to the existing directory, or by restarting a stopped container. However, I am on Ubuntu, not Windows.

A) Is everyone on this thread running on Windows when they hit this problem?
B) Does anyone else experience the problem being solved by moving to 5.6, as @troy-rudolph mentioned above?

@troy-rudolph
Copy link

Here in our development team, there are a number of people running Docker on macOS. They do not have the problem. A couple of us are working on Windows; we have the problem. I just updated to 17.12 and still have the problem.

Hope this helps.

@yosifkit
Copy link
Member

Perhaps this is really a duplicate of #42 and this #42 (comment) applies.

@troy-rudolph
Copy link

Looking at the log excerpts posted here and in #42, it seems to me that this is a duplicate of #42. So in Percona 5.7, what does it need from the file system that it cannot get on a hosted volume? (Our docker configuration is shared across our entire dev team, so changing it to not use hosted volumes would be difficult.)

@yosifkit
Copy link
Member

#42 (comment):

we have no idea where the problem is, but it only happens when using a folder shared across VM to host. I believe the current workaround is to not use a host mounted volume with percona:5.7 on Docker for Windows. If you are using docker-compose, [a named] volume that contains your database files will be kept around unless you explicitly delete it.

@wglambert wglambert added the question Usability question, not directly related to an error with the image label Apr 24, 2018
@wglambert
Copy link

Issue seems to be a duplicate of #42 and that thread seems more active so I'm going to prune

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Usability question, not directly related to an error with the image
Projects
None yet
Development

No branches or pull requests

7 participants