Unable to run mariadb when mount volume

I could run mariadb as a daemon with the command
PS D:\docker> docker run --name mariadb2 -e MYSQL_ROOT_PASSWORD=password -d mariadb
but couldn’t run with the command
PS D:\docker> docker run --name mariadb2 -v /d/docker/volume/db:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=password -d mariadb

the folder had some files created in there so it should have mounted properly.

Information

PS D:\docker> docker logs mariadb2
Initializing database
2016-08-15 8:50:13 139894536869824 [Note] /usr/sbin/mysqld (mysqld 10.1.16-MariaDB-1~jessie) starting as process 51 …
2016-08-15 8:50:13 139894536869824 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2016-08-15 8:50:13 139894536869824 [Note] InnoDB: The InnoDB memory heap is disabled
2016-08-15 8:50:13 139894536869824 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-08-15 8:50:13 139894536869824 [Note] InnoDB: Memory barrier is not used
2016-08-15 8:50:13 139894536869824 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-08-15 8:50:13 139894536869824 [Note] InnoDB: Using Linux native AIO
2016-08-15 8:50:13 139894536869824 [Note] InnoDB: Using SSE crc32 instructions
2016-08-15 8:50:13 139894536869824 [Note] InnoDB: Initializing buffer pool, size = 256.0M
2016-08-15 8:50:13 139894536869824 [Note] InnoDB: Completed initialization of buffer pool
2016-08-15 8:50:13 139894536869824 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2016-08-15 8:50:13 139894536869824 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2016-08-15 8:50:13 139894536869824 [Note] InnoDB: Database physically writes the file full: wait…
2016-08-15 08:50:13 7f3bbc2d17c0 InnoDB: Error: Write to file ./ibdata1 failed at offset 0.
InnoDB: 1048576 bytes should have been written, only 0 were written.
InnoDB: Operating system error number 22.
InnoDB: Check that your OS and file system support files of this size.
InnoDB: Check also that the disk is not full or a disk quota exceeded.
InnoDB: Error number 22 means ‘Invalid argument’.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html
2016-08-15 8:50:13 139894536869824 [ERROR] InnoDB: Error in creating ./ibdata1: probably out of disk space
2016-08-15 8:50:13 139894536869824 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to
ailed 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 th
rote 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 prec
2016-08-15 8:50:13 139894536869824 [ERROR] Plugin ‘InnoDB’ init function returned error.
2016-08-15 8:50:13 139894536869824 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.
2016-08-15 8:50:14 139894536869824 [ERROR] Unknown/unsupported storage engine: InnoDB
2016-08-15 8:50:14 139894536869824 [ERROR] Aborting

PS D:\docker> docker info
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 27
Server Version: 1.12.0
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 77
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: host bridge null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 4.4.15-moby
Operating System: Alpine Linux v3.4
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.95 GiB
Name: moby
ID: ZCNG:T3MP:ORJH:E5V4:SBTR:PFKC:DMBM:IG2C:QHQE:FICI:ALHP:JKNO
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
127.0.0.0/8

PS D:\docker> docker version
Client:
Version: 1.12.0
API version: 1.24
Go version: go1.6.3
Git commit: 8eab29e
Built: Thu Jul 28 21:04:48 2016
OS/Arch: windows/amd64
Experimental: true

Server:
Version: 1.12.0
API version: 1.24
Go version: go1.6.3
Git commit: 8eab29e
Built: Thu Jul 28 21:04:48 2016
OS/Arch: linux/amd64
Experimental: true

Steps to reproduce the behavior

PS D:\docker> docker run --name mariadb2 -v /d/docker/volume/db:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=password -d mariadb

Hey Anurat,

I am experiencing the exact same issue and cannot seem to find a solution.

I also tried sharing the directory from within docker settings AND from windows settings, with the same issue. No luck!

Thanks
Dave

Same for me. At run, other files are written to the db directory, but fails at ./ibdata1 with the same error.
Using: MariaDB 10.1.18

docker info

Containers: 2
 Running: 0
 Paused: 0
 Stopped: 2
Images: 3
Server Version: 1.12.3-rc1
Storage Driver: overlay2
 Backing Filesystem: extfs
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: overlay null host bridge
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 4.4.27-moby
Operating System: Alpine Linux v3.4
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.919 GiB
Name: moby
ID: I6P7:SIGV:Z7YN:GVZX:F3JN:IA44:MHX3:AO4Z:KQIE:Z4JI:455X:2W33
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 12
 Goroutines: 23
 System Time: 2016-10-26T07:52:43.1990344Z
 EventsListeners: 0
Registry: https://index.docker.io/v1/
WARNING: No kernel memory limit support
Experimental: true
Insecure Registries:
 127.0.0.0/8

There was an InnoDB bug, but it was fixed in InnoDB-5.6.30 which was added to MariaDB 10.1.14 back in May.

I am using the same, but I can’t tell which version of InnoDB is being loaded… Anyway to get that from the failed container?

Run with:
docker run --name mdb -p 3306:3306 -v //D/docker/mariadb/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=password -d mariadb:10.1

Logs:
Initializing database
2016-10-26 15:36:11 139744034076608 [Note] /usr/sbin/mysqld (mysqld 10.1.18-MariaDB-1~jessie) starting as process 60 …
2016-10-26 15:36:11 139744034076608 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2016-10-26 15:36:11 139744034076608 [Note] InnoDB: The InnoDB memory heap is disabled
2016-10-26 15:36:11 139744034076608 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-10-26 15:36:11 139744034076608 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2016-10-26 15:36:11 139744034076608 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-10-26 15:36:11 139744034076608 [Note] InnoDB: Using Linux native AIO
2016-10-26 15:36:11 139744034076608 [Note] InnoDB: Using SSE crc32 instructions
2016-10-26 15:36:11 139744034076608 [Note] InnoDB: Initializing buffer pool, size = 256.0M
2016-10-26 15:36:11 139744034076608 [Note] InnoDB: Completed initialization of buffer pool
2016-10-26 15:36:11 139744034076608 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2016-10-26 15:36:11 139744034076608 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2016-10-26 15:36:11 139744034076608 [Note] InnoDB: Database physically writes the file full: wait…
2016-10-26 15:36:11 7f18b182b7c0 InnoDB: Error: Write to file ./ibdata1 failed at offset 0.
InnoDB: 1048576 bytes should have been written, only 0 were written.
InnoDB: Operating system error number 22.
InnoDB: Check that your OS and file system support files of this size.
InnoDB: Check also that the disk is not full or a disk quota exceeded.
InnoDB: Error number 22 means ‘Invalid argument’.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html
2016-10-26 15:36:11 139744034076608 [ERROR] InnoDB: Error in creating ./ibdata1: probably out of disk space
2016-10-26 15:36:11 139744034076608 [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-10-26 15:36:11 139744034076608 [ERROR] Plugin ‘InnoDB’ init function returned error.
2016-10-26 15:36:11 139744034076608 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.
2016-10-26 15:36:11 139744034076608 [ERROR] Unknown/unsupported storage engine: InnoDB
2016-10-26 15:36:11 139744034076608 [ERROR] Aborting