我是docker的新手,我试图在docker中运行mariadb守护程序。 我可以使用命令
运行mariadb作为守护进程PS D:\docker> docker run --name mariadb2 -e MYSQL_ROOT_PASSWORD=password -d mariadb
但无法使用命令
运行PS D:\docker> docker run --name mariadb2 -v /d/docker/volume/db:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=password -d mariadb
该文件夹中已创建了一些文件,因此它应该已正确安装。
以下是日志和系统信息
> 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
提前致谢
答案 0 :(得分:0)
之前我遇到过同样的问题。 显然,当在Windows上使用docker时(在我的情况下),它有文件路径问题。在这种情况下,解决方案是使用以下命令在docker中创建卷:
docker volume create --name=your_volume
然后在docker compose中你会有像
这样的东西 db:
image: mariadb
volumes:
- volume_db:/var/lib/mysql
希望这有助于你