New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can mount volumes from host for MySQL data on Windows Docker #42

Closed
AleshchenkoMaksim opened this Issue Mar 22, 2017 · 32 comments

Comments

Projects
None yet
@AleshchenkoMaksim
Copy link

AleshchenkoMaksim commented Mar 22, 2017

i have same problem. Percona(or mariadb or mysql) can not start.

Docker stats:
docker -v
Docker version 17.03.0-ce, build 60ccb22
docker-compose -v
docker-compose version 1.11.2, build f963d76f
docker-machine -v
docker-machine.exe version 0.10.0, build 76ed2a6

Windows 10.

docker-compose.yml

_version: '2'
services:
  db:
    image: percona:latest
    volumes:
      - ./data/db:/var/lib/mysql
    restart: always
    container_name: mysql
    environment:
      MYSQL_ROOT_PASSWORD: 1234
      MYSQL_DATABASE: db
      MYSQL_USER: db_user
      MYSQL_PASSWORD: 1234_

Docker log:

Initializing database
2017-03-22T21:00:02.880303Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2017-03-22T21:00:02.880349Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2017-03-22T21:00:05.468269Z 0 [Warning] InnoDB: Retry attempts for writing partial data failed.
2017-03-22T21:00:05.468309Z 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.
2017-03-22T21:00:05.468321Z 0 [ERROR] InnoDB: Error number 22 means 'Invalid argument'
2017-03-22T21:00:05.469852Z 0 [ERROR] InnoDB: InnoDB Database creation was aborted with error Generic error. You may need to delete the ibdata1 file before trying to start up again.
2017-03-22T21:00:06.070990Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2017-03-22T21:00:06.071021Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-03-22T21:00:06.071025Z 0 [ERROR] Failed to initialize plugins.
2017-03-22T21:00:06.071028Z 0 [ERROR] Aborting

It's not permissions problems because some files was created. look this screen: http://joxi.ru/n2Y05v5CxGLLm6

I think that some problems with write db files to host machine.
There are ideas for solving the problem.

@learningnewthings

This comment has been minimized.

Copy link

learningnewthings commented Apr 23, 2017

TL;DR this can be fixed here (bitnami doesn't have this issue)

This is an old BUG with both Percona and MariaDB Dockerfiles. ( there are many bug reports, but in the wrong places, i.e. : docker-library/mariadb#38 )

Truthfully, this may be a Windows Docker bug, BUT this can be fixed from this Dockerfile, as both bitnami/mariadb and webhippie/mariadb Dockerfiles do NOT have this bug.

Until it get's fixed, for Windows Docker, you can use bitnami/mariadb or webhippie/mariadb Dokerfiles.

@yosifkit

This comment has been minimized.

Copy link
Member

yosifkit commented Apr 25, 2017

I am unable to reproduce; it runs fine with a mounted folder and I can even connect to the container from another container. I am on a slightly newer version of docker also using docker-toolbox on Windows 10.

$ docker version
Client:
 Version:      17.04.0-ce
 API version:  1.28
 Go version:   go1.7.5
 Git commit:   4845c56
 Built:        Wed Apr  5 23:33:17 2017
 OS/Arch:      windows/amd64

Server:
 Version:      17.04.0-ce
 API version:  1.28 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   4845c56
 Built:        Wed Apr  5 18:45:47 2017
 OS/Arch:      linux/amd64
 Experimental: false

Percona logs:

sauron@Osgiliath MINGW64 ~/dicker
$ docker-compose up
Creating mysql
Attaching to mysql
mysql | Initializing database
mysql | 2017-04-25T21:42:01.355538Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
mysql | 2017-04-25T21:42:01.355576Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
mysql | 2017-04-25T21:42:01.360806Z 0 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
mysql | 2017-04-25T21:42:01.766566Z 0 [Warning] InnoDB: Failed to set O_DIRECT on file/var/lib/mysql/xb_doublewrite;create: Invalid argument, continuing anyway. O_DIRECT is known to result in 'Invalid argument' on Linux on tmpfs, see MySQL Bug#26662.
mysql | 2017-04-25T21:42:01.804560Z 0 [Warning] InnoDB: New log files created, LSN=45790
mysql | 2017-04-25T21:42:02.275272Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
mysql | 2017-04-25T21:42:02.335841Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 04956ebc-2a00-11e7-a942-0242ac120002.
mysql | 2017-04-25T21:42:02.349077Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
mysql | 2017-04-25T21:42:02.613607Z 0 [Warning] CA certificate ca.pem is self signed.
mysql | 2017-04-25T21:42:02.656332Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
mysql | 2017-04-25T21:42:06.864916Z 1 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
mysql | 2017-04-25T21:42:06.865012Z 1 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
mysql | 2017-04-25T21:42:06.865102Z 1 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
mysql | 2017-04-25T21:42:06.865166Z 1 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
mysql | 2017-04-25T21:42:06.865264Z 1 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
mysql | Database initialized
mysql | MySQL init process in progress...
mysql | 2017-04-25T21:42:10.448664Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
mysql | 2017-04-25T21:42:10.448703Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
mysql | 2017-04-25T21:42:10.452147Z 0 [Note] mysqld (mysqld 5.7.17-13) starting as process 54 ...
mysql | 2017-04-25T21:42:10.455650Z 0 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
mysql | 2017-04-25T21:42:10.457287Z 0 [Note] InnoDB: PUNCH HOLE support available
mysql | 2017-04-25T21:42:10.457484Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mysql | 2017-04-25T21:42:10.457506Z 0 [Note] InnoDB: Uses event mutexes
mysql | 2017-04-25T21:42:10.457518Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
mysql | 2017-04-25T21:42:10.457602Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
mysql | 2017-04-25T21:42:10.457614Z 0 [Note] InnoDB: Using Linux native AIO
mysql | 2017-04-25T21:42:10.457768Z 0 [Note] InnoDB: Number of pools: 1
mysql | 2017-04-25T21:42:10.457836Z 0 [Note] InnoDB: Using CPU crc32 instructions
mysql | 2017-04-25T21:42:10.458712Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
mysql | 2017-04-25T21:42:10.460999Z 0 [Note] InnoDB: Completed initialization of buffer pool
mysql | 2017-04-25T21:42:10.462330Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
mysql | 2017-04-25T21:42:10.483234Z 0 [Note] InnoDB: Crash recovery did not find the parallel doublewrite buffer at /var/lib/mysql/xb_doublewrite
mysql | 2017-04-25T21:42:10.489370Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
mysql | 2017-04-25T21:42:10.499502Z 0 [Warning] InnoDB: Failed to set O_DIRECT on file/var/lib/mysql/xb_doublewrite;create: Invalid argument, continuing anyway. O_DIRECT is known to result in 'Invalid argument' on Linux on tmpfs, see MySQL Bug#26662.
mysql | 2017-04-25T21:42:10.516846Z 0 [Note] InnoDB: Created parallel doublewrite buffer at /var/lib/mysql/xb_doublewrite, size 3932160 bytes
mysql | 2017-04-25T21:42:10.543221Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
mysql | 2017-04-25T21:42:10.544050Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
mysql | 2017-04-25T21:42:10.588437Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
mysql | 2017-04-25T21:42:10.592841Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
mysql | 2017-04-25T21:42:10.592924Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
mysql | 2017-04-25T21:42:10.593226Z 0 [Note] InnoDB: Waiting for purge to start
mysql | 2017-04-25T21:42:10.644124Z 0 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.7.17-13 started; log sequence number 2497683
mysql | 2017-04-25T21:42:10.646642Z 0 [Note] Plugin 'FEDERATED' is disabled.
mysql | 2017-04-25T21:42:10.651025Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
mysql | 2017-04-25T21:42:10.676861Z 0 [Warning] World-writable config file './auto.cnf' is ignored.
mysql | 2017-04-25T21:42:10.678811Z 0 [Warning] World-writable config file './auto.cnf' has been removed.
mysql |
mysql | 2017-04-25T21:42:10.679946Z 0 [Note] Salting uuid generator variables, current_pid: 54, server_start_time: 1493156530, bytes_sent: 0,
mysql | 2017-04-25T21:42:10.681396Z 0 [Note] Generated uuid: '098edd91-2a00-11e7-82a0-0242ac120002', server_start_time: 15199650235532008, bytes_sent: 59999984
mysql | 2017-04-25T21:42:10.682442Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 098edd91-2a00-11e7-82a0-0242ac120002.
mysql | 2017-04-25T21:42:10.705437Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
mysql | 2017-04-25T21:42:10.705546Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
mysql | 2017-04-25T21:42:10.706867Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170425 21:42:10
mysql | 2017-04-25T21:42:10.709303Z 0 [Warning] CA certificate ca.pem is self signed.
mysql | 2017-04-25T21:42:10.710156Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
mysql | 2017-04-25T21:42:10.731618Z 0 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
mysql | 2017-04-25T21:42:10.731695Z 0 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
mysql | 2017-04-25T21:42:10.731782Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
mysql | 2017-04-25T21:42:10.731838Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
mysql | 2017-04-25T21:42:10.759185Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
mysql | 2017-04-25T21:42:10.855831Z 0 [Note] Event Scheduler: Loaded 0 events
mysql | 2017-04-25T21:42:10.855980Z 0 [Note] Executing 'SELECT * FROM INFORMATION_SCHEMA.TABLES;' to get a list of tables using the deprecated partition engine. You may use the startup option '--disable-partition-engine-check' to skip this check.
mysql | 2017-04-25T21:42:10.855997Z 0 [Note] Beginning of list of non-natively partitioned tables
mysql | 2017-04-25T21:42:11.004996Z 0 [Note] End of list of non-natively partitioned tables
mysql | 2017-04-25T21:42:11.005122Z 0 [Note] mysqld: ready for connections.
mysql | Version: '5.7.17-13'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  Percona Server (GPL), Release '13', Revision 'fd33d43'
mysql | Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
mysql | Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
mysql | Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
mysql | 2017-04-25T21:42:13.833353Z 5 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
mysql | 2017-04-25T21:42:13.833706Z 5 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
mysql | 2017-04-25T21:42:13.833875Z 5 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
mysql | mysql: [Warning] Using a password on the command line interface can be insecure.
mysql | mysql: [Warning] Using a password on the command line interface can be insecure.
mysql | mysql: [Warning] Using a password on the command line interface can be insecure.
mysql | mysql: [Warning] Using a password on the command line interface can be insecure.
mysql | 2017-04-25T21:42:13.913781Z 9 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
mysql | 2017-04-25T21:42:13.914124Z 9 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
mysql | 2017-04-25T21:42:13.922375Z 9 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
mysql |
mysql | 2017-04-25T21:42:13.925122Z 0 [Note] Giving 1 client threads a chance to die gracefully
mysql | 2017-04-25T21:42:13.925178Z 0 [Note] Shutting down slave threads
mysql | 2017-04-25T21:42:15.925617Z 0 [Note] Forcefully disconnecting 0 remaining clients
mysql | 2017-04-25T21:42:15.925698Z 0 [Note] Event Scheduler: Purging the queue. 0 events
mysql | 2017-04-25T21:42:15.925753Z 0 [Note] Binlog end
mysql | 2017-04-25T21:42:15.936283Z 0 [Note] Shutting down plugin 'ngram'
mysql | 2017-04-25T21:42:15.936404Z 0 [Note] Shutting down plugin 'partition'
mysql | 2017-04-25T21:42:15.936421Z 0 [Note] Shutting down plugin 'ARCHIVE'
mysql | 2017-04-25T21:42:15.936432Z 0 [Note] Shutting down plugin 'BLACKHOLE'
mysql | 2017-04-25T21:42:15.936443Z 0 [Note] Shutting down plugin 'CSV'
mysql | 2017-04-25T21:42:15.936453Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
mysql | 2017-04-25T21:42:15.936462Z 0 [Note] Shutting down plugin 'INNODB_CHANGED_PAGES'
mysql | 2017-04-25T21:42:15.936471Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
mysql | 2017-04-25T21:42:15.936480Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
mysql | 2017-04-25T21:42:15.936488Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
mysql | 2017-04-25T21:42:15.936498Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
mysql | 2017-04-25T21:42:15.936508Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
mysql | 2017-04-25T21:42:15.936517Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
mysql | 2017-04-25T21:42:15.936528Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
mysql | 2017-04-25T21:42:15.936579Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
mysql | 2017-04-25T21:42:15.936592Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
mysql | 2017-04-25T21:42:15.936602Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
mysql | 2017-04-25T21:42:15.936610Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
mysql | 2017-04-25T21:42:15.936619Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
mysql | 2017-04-25T21:42:15.936628Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
mysql | 2017-04-25T21:42:15.936638Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
mysql | 2017-04-25T21:42:15.936647Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
mysql | 2017-04-25T21:42:15.936658Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
mysql | 2017-04-25T21:42:15.936669Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
mysql | 2017-04-25T21:42:15.936678Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
mysql | 2017-04-25T21:42:15.936687Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
mysql | 2017-04-25T21:42:15.936697Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
mysql | 2017-04-25T21:42:15.936706Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
mysql | 2017-04-25T21:42:15.936715Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
mysql | 2017-04-25T21:42:15.936723Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
mysql | 2017-04-25T21:42:15.936732Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
mysql | 2017-04-25T21:42:15.936741Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
mysql | 2017-04-25T21:42:15.936749Z 0 [Note] Shutting down plugin 'INNODB_CMP'
mysql | 2017-04-25T21:42:15.936758Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
mysql | 2017-04-25T21:42:15.936767Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
mysql | 2017-04-25T21:42:15.936775Z 0 [Note] Shutting down plugin 'INNODB_TRX'
mysql | 2017-04-25T21:42:15.936784Z 0 [Note] Shutting down plugin 'XTRADB_ZIP_DICT_COLS'
mysql | 2017-04-25T21:42:15.936793Z 0 [Note] Shutting down plugin 'XTRADB_ZIP_DICT'
mysql | 2017-04-25T21:42:15.936802Z 0 [Note] Shutting down plugin 'XTRADB_RSEG'
mysql | 2017-04-25T21:42:15.936811Z 0 [Note] Shutting down plugin 'XTRADB_INTERNAL_HASH_TABLES'
mysql | 2017-04-25T21:42:15.936819Z 0 [Note] Shutting down plugin 'XTRADB_READ_VIEW'
mysql | 2017-04-25T21:42:15.936827Z 0 [Note] Shutting down plugin 'InnoDB'
mysql | 2017-04-25T21:42:15.937140Z 0 [Note] InnoDB: FTS optimize thread exiting.
mysql | 2017-04-25T21:42:15.937280Z 0 [Note] InnoDB: Starting shutdown...
mysql | 2017-04-25T21:42:16.040110Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
mysql | 2017-04-25T21:42:16.051629Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 170425 21:42:16
mysql | 2017-04-25T21:42:16.843824Z 0 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
mysql | 2017-04-25T21:42:18.229901Z 0 [Note] InnoDB: Shutdown completed; log sequence number 12103830
mysql | 2017-04-25T21:42:18.236984Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
mysql | 2017-04-25T21:42:18.237226Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
mysql | 2017-04-25T21:42:18.237280Z 0 [Note] Shutting down plugin 'MEMORY'
mysql | 2017-04-25T21:42:18.237483Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
mysql | 2017-04-25T21:42:18.237721Z 0 [Note] Shutting down plugin 'MyISAM'
mysql | 2017-04-25T21:42:18.237794Z 0 [Note] Shutting down plugin 'sha256_password'
mysql | 2017-04-25T21:42:18.237984Z 0 [Note] Shutting down plugin 'mysql_native_password'
mysql | 2017-04-25T21:42:18.238635Z 0 [Note] Shutting down plugin 'binlog'
mysql | 2017-04-25T21:42:18.242957Z 0 [Note] mysqld: Shutdown complete
mysql |
mysql |
mysql | MySQL init process done. Ready for start up.
mysql |
mysql | 2017-04-25T21:42:18.458709Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
mysql | 2017-04-25T21:42:18.458752Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
mysql | 2017-04-25T21:42:18.461894Z 0 [Note] mysqld (mysqld 5.7.17-13) starting as process 1 ...
mysql | 2017-04-25T21:42:18.465219Z 0 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
mysql | 2017-04-25T21:42:18.467163Z 0 [Note] InnoDB: PUNCH HOLE support available
mysql | 2017-04-25T21:42:18.467210Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mysql | 2017-04-25T21:42:18.467219Z 0 [Note] InnoDB: Uses event mutexes
mysql | 2017-04-25T21:42:18.467228Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
mysql | 2017-04-25T21:42:18.467235Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
mysql | 2017-04-25T21:42:18.467242Z 0 [Note] InnoDB: Using Linux native AIO
mysql | 2017-04-25T21:42:18.467433Z 0 [Note] InnoDB: Number of pools: 1
mysql | 2017-04-25T21:42:18.467501Z 0 [Note] InnoDB: Using CPU crc32 instructions
mysql | 2017-04-25T21:42:18.468710Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
mysql | 2017-04-25T21:42:18.470965Z 0 [Note] InnoDB: Completed initialization of buffer pool
mysql | 2017-04-25T21:42:18.472597Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
mysql | 2017-04-25T21:42:18.492430Z 0 [Note] InnoDB: Crash recovery did not find the parallel doublewrite buffer at /var/lib/mysql/xb_doublewrite
mysql | 2017-04-25T21:42:18.496968Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
mysql | 2017-04-25T21:42:18.505850Z 0 [Warning] InnoDB: Failed to set O_DIRECT on file/var/lib/mysql/xb_doublewrite;create: Invalid argument, continuing anyway. O_DIRECT is known to result in 'Invalid argument' on Linux on tmpfs, see MySQL Bug#26662.
mysql | 2017-04-25T21:42:18.523991Z 0 [Note] InnoDB: Created parallel doublewrite buffer at /var/lib/mysql/xb_doublewrite, size 3932160 bytes
mysql | 2017-04-25T21:42:18.554120Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
mysql | 2017-04-25T21:42:18.555783Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
mysql | 2017-04-25T21:42:18.598681Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
mysql | 2017-04-25T21:42:18.603714Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
mysql | 2017-04-25T21:42:18.603794Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
mysql | 2017-04-25T21:42:18.603993Z 0 [Note] InnoDB: Waiting for purge to start
mysql | 2017-04-25T21:42:18.654389Z 0 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.7.17-13 started; log sequence number 12103830
mysql | 2017-04-25T21:42:18.655348Z 0 [Note] Plugin 'FEDERATED' is disabled.
mysql | 2017-04-25T21:42:18.656755Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
mysql | 2017-04-25T21:42:18.664977Z 0 [Warning] World-writable config file './auto.cnf' is ignored.
mysql | 2017-04-25T21:42:18.666761Z 0 [Warning] World-writable config file './auto.cnf' has been removed.
mysql |
mysql | 2017-04-25T21:42:18.668436Z 0 [Note] Salting uuid generator variables, current_pid: 1, server_start_time: 1493156538, bytes_sent: 0,
mysql | 2017-04-25T21:42:18.669257Z 0 [Note] Generated uuid: '0e51b799-2a00-11e7-80d3-0242ac120002', server_start_time: 281476469867195, bytes_sent: 59799280
mysql | 2017-04-25T21:42:18.669344Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 0e51b799-2a00-11e7-80d3-0242ac120002.
mysql | 2017-04-25T21:42:18.692530Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
mysql | 2017-04-25T21:42:18.693080Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
mysql | 2017-04-25T21:42:18.697286Z 0 [Warning] CA certificate ca.pem is self signed.
mysql | 2017-04-25T21:42:18.698309Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
mysql | 2017-04-25T21:42:18.704217Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
mysql | 2017-04-25T21:42:18.712301Z 0 [Note] IPv6 is available.
mysql | 2017-04-25T21:42:18.712313Z 0 [Note]   - '::' resolves to '::';
mysql | 2017-04-25T21:42:18.712327Z 0 [Note] Server socket created on IP: '::'.
mysql | 2017-04-25T21:42:18.731432Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170425 21:42:18
mysql | 2017-04-25T21:42:18.736558Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
mysql | 2017-04-25T21:42:18.736995Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
mysql | 2017-04-25T21:42:18.759067Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
mysql | 2017-04-25T21:42:18.847231Z 0 [Note] Event Scheduler: Loaded 0 events
mysql | 2017-04-25T21:42:18.847349Z 0 [Note] Executing 'SELECT * FROM INFORMATION_SCHEMA.TABLES;' to get a list of tables using the deprecated partition engine. You may use the startup option '--disable-partition-engine-check' to skip this check.
mysql | 2017-04-25T21:42:18.847366Z 0 [Note] Beginning of list of non-natively partitioned tables
mysql | 2017-04-25T21:42:18.980612Z 0 [Note] End of list of non-natively partitioned tables
mysql | 2017-04-25T21:42:18.980721Z 0 [Note] mysqld: ready for connections.
mysql | Version: '5.7.17-13'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  Percona Server (GPL), Release '13', Revision 'fd33d43'
@AleshchenkoMaksim

This comment has been minimized.

Copy link
Author

AleshchenkoMaksim commented Apr 26, 2017

@yosifkit can you show your docker-compose.yml file? You mount volume to host machine or use named volume?

@fcarreiro

This comment has been minimized.

Copy link

fcarreiro commented Apr 26, 2017

@kwek20 just reproduced it. With Windows 10, mariadb:10 and latest Docker Edge. I'll let him write the details. docker-compose file is

    image: mariadb:10
    container_name: dbname
    environment:
      MYSQL_ROOT_PASSWORD: devpassword
      MYSQL_DATABASE: somedb
    volumes:
      - ./mysqldata:/var/lib/mysql
    ports:
      - '3306:3306'

The official mysql:8 image did work. We are now trying the bitnami versions. It looks like indeed this could be fixed. Do we at least know what is going wrong? I mean, if it is something from the MariaDB binaries or if it is really related to the docker image.

@yosifkit

This comment has been minimized.

Copy link
Member

yosifkit commented Apr 27, 2017

Here is my compose file. I used docker 17.04.0-ce, Windows 10 Home, Oracle VirtualBox using the default Shared Folders that docker-toobox creates for the VM (C:\Users), run from a folder in my user directory c:\Users\my-user\docker\

version: '2'
services:
  db:
    image: percona:5.7.17
    volumes:
      - ./sql-data/db:/var/lib/mysql
    container_name: sql-server
    environment:
      MYSQL_ROOT_PASSWORD: 1234
      MYSQL_DATABASE: db
      MYSQL_USER: db_user
      MYSQL_PASSWORD: 1234_
@yosifkit

This comment has been minimized.

Copy link
Member

yosifkit commented Apr 27, 2017

I set up a minimal compose file to test all current versions of mariadb, mysql, and percona each with a directory shared from the host. So far from my testing, the only one failing is mariadb:10.1.

docker-compose.yml for running all 10 sql servers

You'll need a VM with enough memory if you want to test all 10 at once; 1 GB was not enough. 😮

version: '2'
services:
  mysql8.1:
    image: mysql:8.0.1
    volumes:
      - ./sql-data/mysql-8.0.1:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: 1234

  mysql5.7:
    image: mysql:5.7.18
    volumes:
      - ./sql-data/mysql-5.7.18:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: 1234

  mysql5.6:
    image: mysql:5.6.36
    volumes:
      - ./sql-data/mysql-5.6.36:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: 1234

  mysql5.5:
    image: mysql:5.5.55
    volumes:
      - ./sql-data/mysql-5.5.55:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: 1234

  maria10.1:
    image: mariadb:10.1.22
    volumes:
      - ./sql-data/mariadb-10.1.22:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: 1234

  maria10.0:
    image: mariadb:10.0.30
    volumes:
      - ./sql-data/mariadb-10.0.30:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: 1234

  maria5.5:
    image: mariadb:5.5.55
    volumes:
      - ./sql-data/mariadb-5.5.55:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: 1234

  percona5.7:
    image: percona:5.7.17
    volumes:
      - ./sql-data/percona-5.7.17:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: 1234

  percona5.6:
    image: percona:5.6.35
    volumes:
      - ./sql-data/percona-5.6.35:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: 1234

  percona5.5:
    image: percona:5.5.54
    volumes:
      - ./sql-data/percona-5.5.54:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: 1234
$ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                     PORTS               NAMES
69039f90ce66        mysql:5.5.55        "docker-entrypoint..."   9 minutes ago       Up 9 minutes               3306/tcp            docker_mysql5.5_1
ce952aa6625d        mysql:5.7.18        "docker-entrypoint..."   9 minutes ago       Up 9 minutes               3306/tcp            docker_mysql5.7_1
4c875dcbb923        mysql:5.6.36        "docker-entrypoint..."   9 minutes ago       Up 9 minutes               3306/tcp            docker_mysql5.6_1
6090aee1e391        mariadb:10.1.22     "docker-entrypoint..."   9 minutes ago       Exited (1) 9 minutes ago                       docker_maria10.1_1
886bc7a398bb        mysql:8.0.1         "docker-entrypoint..."   9 minutes ago       Up 9 minutes               3306/tcp            docker_mysql8.1_1
1042b4b3bb27        mariadb:5.5.55      "docker-entrypoint..."   9 minutes ago       Up 9 minutes               3306/tcp            docker_maria5.5_1
c1424e0f9733        percona:5.7.17      "docker-entrypoint..."   9 minutes ago       Up 9 minutes               3306/tcp            docker_percona5.7_1
9a94804da8bc        mariadb:10.0.30     "docker-entrypoint..."   9 minutes ago       Up 9 minutes               3306/tcp            docker_maria10.0_1
7d36667bec6a        percona:5.6.35      "docker-entrypoint..."   9 minutes ago       Up 9 minutes               3306/tcp            docker_percona5.6_1
a7ac853e7c05        percona:5.5.54      "docker-entrypoint..."   9 minutes ago       Up 9 minutes               3306/tcp            docker_percona5.5_1
@fcarreiro

This comment has been minimized.

Copy link

fcarreiro commented Apr 28, 2017

@AleshchenkoMaksim

This comment has been minimized.

Copy link
Author

AleshchenkoMaksim commented Apr 28, 2017

@yosifkit you use Oracle VirtualBox or Hyper-V?
I use Hyper-V. All mysql containers was started successful. Percona 5.5 and 5.6 start ok. Percona 5.7 - fail.
All mariadb containers - fail.

@tianon

This comment has been minimized.

Copy link
Member

tianon commented Apr 28, 2017

Using Docker for Windows (NOT Docker Toolbox), I can reproduce the failure of the OP (Invalid argument causing InnoDB to fail to initialize) using mariadb:latest. 😞

@tianon

This comment has been minimized.

Copy link
Member

tianon commented Apr 28, 2017

(Now testing @yosifkit's insane docker-compose.yml -- hopefully my VM is big enough 😇)

@tianon

This comment has been minimized.

Copy link
Member

tianon commented Apr 28, 2017

Definitely successful using Docker for Windows (thus on Hyper-V):

  • mysql:5.5
  • mysql:5.6
  • mysql:5.7
  • mysql:8.0
  • percona:5.5
  • percona:5.6

Definitely failing (Invalid argument as described in the OP):

  • mariadb:5.5
  • mariadb:10.0
  • mariadb:10.1
  • percona:5.7
@Rakhmanov

This comment has been minimized.

Copy link

Rakhmanov commented May 24, 2017

Working Using Docker for Windows:

  • mysql:5.5.55
  • mysql:5.6.36
  • mysql:5.7.18
  • mysql:8.0.1
  • percona:5.5.541
  • percona:5.6.35

Failing the rest.

That would be consistent with results above

@Koc

This comment has been minimized.

Copy link

Koc commented Sep 6, 2017

this issue still not fixed

@yosifkit

This comment has been minimized.

Copy link
Member

yosifkit commented Sep 6, 2017

@Koc, yup, 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, the volume that contains your database files will be kept around unless you explicitly delete it.

The other alternatives are to use Docker Toolbox instead of Docker for Windows, or to use a different SQL database (all versions of MySQL work with a host mounted volume in Docker for Windows, as does Percona 5.5 and 5.6).

I don't have any insight as to why Percona 5.7 and all versions of MariaDB fail when using a host mounted volume on Docker for Windows. I am too unfamiliar with their code to find and fix the issue whether it is in MariaDB/Percona or Docker for Windows.

@Koc

This comment has been minimized.

Copy link

Koc commented Sep 6, 2017

but why it works for 5.6? what had been changed between versions?

@Koc

This comment has been minimized.

Copy link

Koc commented Sep 6, 2017

If you are using docker-compose, the volume that contains your database files will be kept around unless you explicitly delete it.

No, it removes my database on container restart

docker-compose up
create table abc
docker-compose down
docker-compose up
there is no table abc

@yosifkit

This comment has been minimized.

Copy link
Member

yosifkit commented Sep 6, 2017

@Koc

but why it works for 5.6? what had been changed between versions?

The only change in docker image is the version, so it has to be something new that Percona 5.7 requires from the file-system.

# git --no-pager diff --no-index 5.6/Dockerfile 5.7/Dockerfile
diff --git a/5.6/Dockerfile b/5.7/Dockerfile
index a379500..105bbdb 100644
--- a/5.6/Dockerfile
+++ b/5.7/Dockerfile
@@ -49,8 +49,8 @@ RUN set -ex; \
 
 RUN echo 'deb https://repo.percona.com/apt jessie main' > /etc/apt/sources.list.d/percona.list
 
-ENV PERCONA_MAJOR 5.6
-ENV PERCONA_VERSION 5.6.37-82.2-1.jessie
+ENV PERCONA_MAJOR 5.7
+ENV PERCONA_VERSION 5.7.19-17-1.jessie
 
 # the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql)
 # also, we set debconf keys to make APT a little quieter

No, it removes my database on container restart

As far as I have been able to reproduce, down will only remove volumes if you pass the -voption, so the database files do still exist, unfortunately since they are in an anonymous volume compose does not attach the volume to the new containers when you do up again. You can work around this by only using stop and not down or naming your volumes.

$ docker-compose down --help
Stops containers and removes containers, networks, volumes, and images
created by `up`.
...
    -v, --volumes       Remove named volumes declared in the `volumes` section
                        of the Compose file and anonymous volumes
                        attached to containers.
@Koc

This comment has been minimized.

Copy link

Koc commented Sep 7, 2017

@yosifkit thank you for clarification, named volumes are really works.

@lu-ko

This comment has been minimized.

Copy link

lu-ko commented Sep 8, 2017

+1

@SuchyTheMaster

This comment has been minimized.

Copy link

SuchyTheMaster commented Jan 29, 2018

If You have InnoDB: Error number 22 and logs about native_aio. then try add innodb_use_native_aio = 0 to your mysqld config. It disable native aio (yep, i know - it's better to be enabled, but on newest docker toolbox v18.01.0-ce it doesn't work and container Exit).

@rahonalab

This comment has been minimized.

Copy link

rahonalab commented Feb 7, 2018

Same issue here, with mariadb volume shared across containers.

Tested yesterday with a Windows 10, Docker for Windows and mariadb:latest

@jazz-jack

This comment has been minimized.

Copy link

jazz-jack commented Feb 9, 2018

the solution is to use Docker volumes.
change your docker-compose.yml db volumes to refer to global docker volume, for example:

db:
   volumes:
      - dbvolume:/var/lib/mysql

and add new section 'volumes' with that name at the root of the yml file:

volumes:
  dbvolume:

and rebuild all. you'll see the new volume with 'docker volume ls' and it works fine with mariadb:latest

Please read this for details: https://docs.docker.com/compose/compose-file/#volume-configuration-reference

@rahonalab

This comment has been minimized.

Copy link

rahonalab commented Feb 9, 2018

@jazz-jack thank you!
same answer in #docker-library/mariadb#152

@life4u2c

This comment has been minimized.

Copy link

life4u2c commented Feb 9, 2018

@jazz-jack thank you as well. This has worked for me using percona:5.7.17 container

@wglambert wglambert added the question label Apr 25, 2018

@strarsis

This comment has been minimized.

@tianon

This comment has been minimized.

Copy link
Member

tianon commented Apr 30, 2018

Those are compiler switches, so unless you're running a native Win32 build, those don't apply -- we're running Linux builds on a VM in Windows.

@strarsis

This comment has been minimized.

Copy link

strarsis commented Apr 30, 2018

@tianon: You are right, the switches don't apply to linux builds.

It seems though that the options are just ignored because the daemon still tries to use O_DIRECT.

@adaolima

This comment has been minimized.

Copy link

adaolima commented Jul 16, 2018

In my case when I removed the "." from the beginning, It worked.

db:
    image: mariadb
    volumes:
      - /data:/var/lib/mysql`
@cljk

This comment has been minimized.

Copy link

cljk commented Jul 23, 2018

@adaolima OMG
I invested HOURS to get this to work.... THANK YOU

I didn´t check yet:
Is this the same problem when using docker directly?
Is this a problem in docker-machine / docker for windows?
I personally am using Docker Machine (now called "Docker Toolbox"? - not Docker for Windows) on Virtual Box / Win10 and are not willing to switch to Hyper-V.

λ docker version
Client:
 Version:      17.10.0-ce
 API version:  1.33
 Go version:   go1.8.3
 Git commit:   f4ffd25
 Built:        Tue Oct 17 19:00:02 2017
 OS/Arch:      windows/amd64

Server:
 Version:      18.05.0-ce
 API version:  1.37 (minimum version 1.12)
 Go version:   go1.10.1
 Git commit:   f150324
 Built:        Wed May  9 22:20:42 2018
 OS/Arch:      linux/amd64
 Experimental: false
@cljk

This comment has been minimized.

Copy link

cljk commented Jul 23, 2018

Okay.... I´ve been a bit too early to celebrate the "solution".
The data is not stored in my folder nor do I find it on my hard disk (C:\db). It seems that this is not interpreted and is now a path inside the docker vm (boot2docker).
:-/

@strarsis

This comment has been minimized.

Copy link

strarsis commented Jul 23, 2018

@cljk and others with the issue, this workaround with explicit configuration file could help, see:
docker-library/mariadb#38 (comment)

@tianon

This comment has been minimized.

Copy link
Member

tianon commented Jul 23, 2018

Going to close this out given that the original issue is as resolved as we can get it (namely, shared volumes from the host on Windows and OS X tend to have issues -- there are configuration workarounds in docker-library/mariadb#38 (comment) which might help, but that's out of scope for this repo).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment