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

on windows, cannot start a container with host directory as /var/lib/mysql mount #95

Closed
powernic opened this Issue Jan 16, 2017 · 38 comments

Comments

Projects
None yet
@powernic
Copy link

powernic commented Jan 16, 2017

Tried running a mariadb container by means of docker-compose.
This trouble similar to this issue #38
docker-library/mysql#99 (comment) it doesn't solve the issue.

    db:
        image: 'mariadb:latest' 
        environment:  
          - "MYSQL_ROOT_PASSWORD=xxxxxx"  
        container_name: db
        volumes:    
            - "./mysql/db:/var/lib/mysql"  
            - "./mysql/localdb-run.sh:/localdb-run.sh" 
        command: "/localdb-run.sh" 
        restart: always
$ docker-compose run db
Creating network "docker_default" with the default driver
* Working around permission errors locally by making sure that "mysql" uses the same uid and gid as the host volume
-- Setting mysql user to use uid 0
-- Setting mysql group to use gid 0

* Starting MySQL
2017-01-16  0:12:44 139975239862208 [Note] mysqld (mysqld 10.1.19-MariaDB-1~jessie) starting as process 18 ...
2017-01-16  0:12:44 139975239862208 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2017-01-16  0:12:44 139975239862208 [Note] InnoDB: The InnoDB memory heap is disabled
2017-01-16  0:12:44 139975239862208 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-01-16  0:12:44 139975239862208 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-01-16  0:12:44 139975239862208 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-01-16  0:12:44 139975239862208 [Note] InnoDB: Using Linux native AIO
2017-01-16  0:12:44 139975239862208 [Note] InnoDB: Using SSE crc32 instructions
2017-01-16  0:12:44 139975239862208 [Note] InnoDB: Initializing buffer pool, size = 256.0M
2017-01-16  0:12:44 139975239862208 [Note] InnoDB: Completed initialization of buffer pool
2017-01-16  0:12:44 139975239862208 [ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different size 0 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages!
2017-01-16  0:12:44 139975239862208 [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!
2017-01-16  0:12:44 139975239862208 [ERROR] Plugin 'InnoDB' init function returned error.
2017-01-16  0:12:44 139975239862208 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-01-16  0:12:44 139975239862208 [Note] Plugin 'FEEDBACK' is disabled.
2017-01-16  0:12:44 139975239862208 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
2017-01-16  0:12:44 139975239862208 [ERROR] Unknown/unsupported storage engine: InnoDB
2017-01-16  0:12:44 139975239862208 [ERROR] Aborting
@yosifkit

This comment has been minimized.

Copy link
Member

yosifkit commented Jan 16, 2017

I can almost guarantee that the usermod -o -u $TARGET_UID mysql || true from your script is failing; using usermod you can't set another user or group to be id 0 since it is already root. Even if you could, that would cause our script to loop and continually re-exec itself.

If you need to set the user that mysqld uses, you can just set the user on docker run --user 1000:50 (or user: "1000:50" in the compose.yml) and the entrypoint script will skip the parts requiring root access. If you are using docker toolbox and boot2docker, this should be the correct userid and groupid. I am not sure what user and group you would use when running "Docker for Windows"; I was under the impression that it was supposed to just work with regards to permissions on host directories shared to containers.

@powernic

This comment has been minimized.

Copy link
Author

powernic commented Jan 17, 2017

@yosifkit All the same.

    db:
        image: 'mariadb:latest' 
        environment:  
          - "MYSQL_ROOT_PASSWORD=xxxxxx"  
        container_name: db
        volumes:    
            - "./mysql/db:/var/lib/mysql"   
        user: "1000:50"
        restart: always
$ docker-compose run db
2017-01-17 12:16:50 139770370467776 [Note] mysqld (mysqld 10.1.19-MariaDB-1~jessie) starting as process 1 ...
2017-01-17 12:16:50 139770370467776 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2017-01-17 12:16:50 139770370467776 [Note] InnoDB: The InnoDB memory heap is disabled
2017-01-17 12:16:50 139770370467776 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-01-17 12:16:50 139770370467776 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-01-17 12:16:50 139770370467776 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-01-17 12:16:50 139770370467776 [Note] InnoDB: Using Linux native AIO
2017-01-17 12:16:50 139770370467776 [Note] InnoDB: Using SSE crc32 instructions
2017-01-17 12:16:50 139770370467776 [Note] InnoDB: Initializing buffer pool, size = 256.0M
2017-01-17 12:16:50 139770370467776 [Note] InnoDB: Completed initialization of buffer pool
2017-01-17 12:16:50 139770370467776 [ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different size 0 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages!
2017-01-17 12:16:50 139770370467776 [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!
2017-01-17 12:16:50 139770370467776 [ERROR] Plugin 'InnoDB' init function returned error.
2017-01-17 12:16:50 139770370467776 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-01-17 12:16:50 139770370467776 [Note] Plugin 'FEEDBACK' is disabled.
2017-01-17 12:16:50 139770370467776 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
2017-01-17 12:16:50 139770370467776 [ERROR] Unknown/unsupported storage engine: InnoDB
2017-01-17 12:16:50 139770370467776 [ERROR] Aborting

I will try mount a Windows directory as a folder inside Docker VM VirtualBox.

@powernic

This comment has been minimized.

Copy link
Author

powernic commented Jan 17, 2017

It's work with Docker VM on VirtualBox.

@powernic powernic closed this Jan 17, 2017

@imsergiobernal

This comment has been minimized.

Copy link

imsergiobernal commented Jul 25, 2017

Hello I'm facing the same trouble.

MariaDB 10.1.23 and 10.2.7
Windows 10 Pro 64 bits
Docker for Windows with Hyper-v docker

I would like to keep using Hyper-v, how can I solve this ?

@Chrisly3ear

This comment has been minimized.

Copy link

Chrisly3ear commented Aug 1, 2017

Same here.

@yosifkit

This comment has been minimized.

Copy link
Member

yosifkit commented Aug 1, 2017

@sbernaldev and @Chrisly3ear, I believe the current workaround is to not use a host mounted volume with mariadb on Docker for Windows (docker-library/percona#42 (comment)). 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.

@sameronline

This comment has been minimized.

Copy link

sameronline commented Aug 11, 2017

Having the same issue here

@shengnian

This comment has been minimized.

Copy link

shengnian commented Aug 17, 2017

+1

@lmurawsk

This comment has been minimized.

Copy link

lmurawsk commented Aug 19, 2017

Docker for Windows based on Hyper-V is a native Windows 10 docker solution. Being able to mount custom persistent storage from host is in my opinion crucial.

@neuotq

This comment has been minimized.

Copy link

neuotq commented Aug 23, 2017

As a temporary solution, you can do so(in your docker-compose.yml) this is solution for laradoc package:

#- ${DATA_SAVE_PATH}/mariadb:/var/lib/mysql
 - mariadb:/var/lib/mysql
@ericrector

This comment has been minimized.

Copy link

ericrector commented Dec 12, 2017

This has to be a mariadb issue. In my compose file for my phpfpm service use:

volumes:
            - ./public:/usr/share/nginx/html

which works

inspect shows:

"Mounts": [
    {
        "Type": "bind",
        "Source": "/E/docker/01_testing/my_first_docker-compose/public",
        "Destination": "/usr/share/nginx/html",
        "Mode": "rw",
        "RW": true,
        "Propagation": "rprivate"
    }

...

"Volumes": {
    "/usr/share/nginx/html": {}
},

I can modify the files on the host side on the volume mapping everything works as expected.

when I try the same for mariadb service there are problems, for my db service:

 volumes:
            - ./data:/var/lib/mysql

but when I up the mariadb compose I get:

mysql_1 | 2017-12-12 9:53:49 139728345196416 [ERROR] InnoDB: Write to file ./ibdata1 failed 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.
mysql_1 | 2017-12-12 9:53:49 139728345196416 [ERROR] InnoDB: Error number 22 means 'Invalid argument'
mysql_1 | 2017-12-12 9:53:49 139728345196416 [ERROR] InnoDB: Could not set the file size of
./ibdata1'. Probably out of disk space

inspecting the container shows:

"Mounts": [
    {
        "Type": "bind",
        "Source": "/E/docker/02_services/mariaDb/data",
        "Destination": "/var/lib/mysql",
        "Mode": "rw",
        "RW": true,
        "Propagation": "rprivate"
    }

...

"Volumes": {
    "/var/lib/mysql": {}
},

The service did write in to the mapped volume ./data:

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       12/12/2017  10:53 AM                mysql
-a----       12/12/2017  10:53 AM          16384 aria_log.00000001
-a----       12/12/2017  10:53 AM             52 aria_log_control
-a----       12/12/2017  10:53 AM              0 ibdata1

I have also tried using docker run with -v and I get the same outcome.

Interestingly enough, as neuotq suggested if you use the docker internal volumes, then it works.

@rfay rfay referenced this issue Dec 27, 2017

Closed

Switch to mariadb #572

@sameronline

This comment has been minimized.

Copy link

sameronline commented Jan 21, 2018

Same issue here, this is critical bug honestly, any solutions?

@tianon

This comment has been minimized.

Copy link
Member

tianon commented Jan 22, 2018

@sameronline yes, see #95 (comment)

Essentially, the best solution is to put /var/lib/mysql in a volume on your Docker VM (managed via docker volume xyz commands) instead of trying to share those files directly all the way back to your Mac or Windows host filesystem.

@rahonalab

This comment has been minimized.

Copy link

rahonalab commented Feb 7, 2018

sorry for crossposting #152 but, again, this is a critical bug

@tianon but what if I want to use named volumes and share them across containers, in order to keep persistent database data? or am I missing something here?

@dj-ed

This comment has been minimized.

Copy link

dj-ed commented Feb 13, 2018

Same here on Mac! This is an critical issue.

@tianon

This comment has been minimized.

Copy link
Member

tianon commented Feb 13, 2018

Yeah, just use a named volume and connect it to more than one container. However, note that using a named volume already makes the database persistent -- the volume will outlive the container by itself without any additional intervention.

@StevenWillett

This comment has been minimized.

Copy link

StevenWillett commented Mar 10, 2018

Seeing a similar issue with mariadb10.2.X
I'm using a Dockerfile (not docker-compose.yml) to create a standalone MariaDB instance that looks like this currently:

FROM mariadb:10.2

LABEL maintainer="me@domain.com"

# ENVIRONMENT VARIABLES
ENV MYSQL_ROOT_PASSWORD = XXX
ENV MYSQL_DATABASE = XXX
ENV MYSQL_USER = XXX
ENV MYSQL_PASSWORD = XXX
ENV MYSQL_ALLOW_EMPTY_PASSWORD = no
ENV MYSQL_RANDOM_ROOT_PASSWORD = no

# DATABASE SQL FILE(S)
VOLUME ${pwd}/data:/var/lib/mysql

EXPOSE 3306

I have specified a single VOLUME that is my D:\ drive, not the hosts C:\

Builds fine, no errors, but using this docker run command:
docker run -p 3306:3306 --name mariadb -v ${pwd}/data:/var/lib/mysql stevenwillett/mariadb

The terminal output on run and errors are:

PS D:\OneDrive\Projects\XAMPP\htdocs\BitBucket\docker_projects\base_templates\mariadb> docker run -p 3306:3306 --name mariadb -v ${pwd}/data:/var/lib/mysql stevenwillett/mariadb
2018-03-10 11:11:46 140267705505664 [Note] mysqld (mysqld 10.2.13-MariaDB-10.2.13+maria~jessie) starting as process 1 ...
2018-03-10 11:11:46 140267705505664 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-03-10 11:11:46 140267705505664 [Note] InnoDB: Uses event mutexes
2018-03-10 11:11:46 140267705505664 [Note] InnoDB: Compressed tables use zlib 1.2.8
2018-03-10 11:11:46 140267705505664 [Note] InnoDB: Using Linux native AIO
2018-03-10 11:11:46 140267705505664 [Note] InnoDB: Number of pools: 1
2018-03-10 11:11:46 140267705505664 [Note] InnoDB: Using SSE2 crc32 instructions
2018-03-10 11:11:46 140267705505664 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
2018-03-10 11:11:46 140267705505664 [Note] InnoDB: Completed initialization of buffer pool
2018-03-10 11:11:46 140266967877376 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-03-10 11:11:46 140267705505664 [ERROR] InnoDB: The Auto-extending innodb_system data file './ibdata1' is of a different size 0 pages than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages!
2018-03-10 11:11:46 140267705505664 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2018-03-10 11:11:46 140267705505664 [Note] InnoDB: Starting shutdown...
2018-03-10 11:11:46 140267705505664 [ERROR] Plugin 'InnoDB' init function returned error.
2018-03-10 11:11:46 140267705505664 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-03-10 11:11:46 140267705505664 [Note] Plugin 'FEEDBACK' is disabled.
2018-03-10 11:11:46 140267705505664 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
2018-03-10 11:11:46 140267705505664 [ERROR] Unknown/unsupported storage engine: InnoDB
2018-03-10 11:11:46 140267705505664 [ERROR] Aborting

Environment Details:

  • W10 Pro (Hyper-V)
  • Docker CE (Version 17.12.0-ce-win47 (15139))(stable edition)

Any pointers to a solution when using a Dockerfile and not docker-compose.yml file appreciated.

@yosifkit

This comment has been minimized.

Copy link
Member

yosifkit commented Mar 13, 2018

@StevenWillett, the VOLUME line you declare is probably not doing what you think it is doing (see volumes). It is creating a folder at the path /data:/var/lib/mysql/ in the container. VOLUME in a Dockerfile can only declare a directory as a volume and cannot pre-seed where to mount that volume on run.

To use the already defined volume on Docker for Windows you have to use a named volume like @tianon suggested in the comments above yours.

$ docker run -d -p 3306:3306 --name mariadb -v mysql-data:/var/lib/mysql stevenwillett/mariadb
$ # to see the volume
$ docker volume ls

Unfortunately, you cannot mount the folder for MariaDB to the host using Docker for Windows because it presents the shared files/folders permissions to the Linux container as root owned with writable only by root (755).

See also docker-library/percona#42 (comment).

@StevenWillett

This comment has been minimized.

Copy link

StevenWillett commented Mar 13, 2018

Thanks, @yosifkit,
I have managed to get the DB file mapping to work from the container to the Host this evening in fact.
You also helped me free up 3GB of space by clearing my old volumes docker volume prune.

For those interested or facing similar issue ${pwd} is your friend here:

Dockerfile: (Note: removal of VOLUME entirely)

FROM mariadb:10.2

LABEL maintainer="me@domain.com"

RUN apt-get update && apt-get upgrade -y
#RUN apt-get install nano

# ENVIRONMENT VARIABLES
ENV MYSQL_ROOT_PASSWORD some_password
ENV MYSQL_DATABASE some_db_name
ENV MYSQL_USER some_user
ENV MYSQL_PASSWORD some_password

# UPDATE BIND ADDRESS TO ALLOW REMOTE ACCESS (USE A FIREWALL TO MANAGE TRAFFIC)
RUN sed -Ei 's/#bind-address\s+=\s+127.0.0.1/bind-address=0.0.0.0/g' /etc/mysql/my.cnf

EXPOSE 3306

NOTES: Notice I have fully removed the VOLUME option in the Dockerfile as there appears to be a bug with this, plus my docker run command's -v (volume) mapping is overriding this anyhow it would appear.

Docker run command:

docker run -d -p 3306:3306 --name mariadb --restart unless-stopped -v ${pwd}/data/mariadb/base-db:/var/lib/mysql stevenwillett/mariadb

You will most likely want to also add the run command option for --network to allow container linking.

-network test-docker-network

So the updated docker run command would be something like:

docker run -d -p 3306:3306 --name mariadb --restart unless-stopped --network test-docker-network -v ${pwd}/data/mariadb/base-db:/var/lib/mysql stevenwillett/mariadb

If anyone is able to achieve the below run command option as part of the Dockerfile build I would be grateful to hear how instead of needing to include as part of the docker run command.

-v ${pwd}/data/mariadb/base-db:/var/lib/mysql

What I have found out through trying to resolve this issue on Windows is that ${pwd} copies from the container any files of the -v mapped directory.
This has been something I could not find any documentation for. (maybe my search terms)

I hope the above helps someone else facing a similar issue.

@csandanov

This comment has been minimized.

Copy link

csandanov commented Apr 9, 2018

Correct me if I'm wrong but it seems since 17.06 docker changed docker system prune, so it now cleans up volumes only when running with --volumes flag. So if you run a container with a named volume (i.e. VOLUME in image's Dockefile) and then you kill it, you won't lose any data until you run docker system prune --volumes. That's definitely an improvement in my opinion but not really a solution to:

Could not set the file size of './ibdata1'. Probably out of disk space

I want to run docker system prune --volumes to clean up volumes I used for tests without worrying that I might lose some important data. It's still not clear to me why this bug happens with mariadb, I never had any bind mounts issues with other images. Is this possibly related to innodb + docker driver storage? Anyway, I think it's a critical issue and we should reopen the issue (or have a new one).

@yosifkit

This comment has been minimized.

Copy link
Member

yosifkit commented Apr 10, 2018

@csandanov, using a named volume is basically the only option to keep the database files when running MariaDB on Docker for Windows since the host-shared folder presented to the container does not behave in a standard way.

PS C:\Users\sauron> docker run -it --rm -v C:\Users\sauron\tmp\:/my-tmp/ -u 1000:50 debian
I have no name!@664436f5a386:/$ id -u
1000
I have no name!@664436f5a386:/$ id -g
50
I have no name!@664436f5a386:/$ cd /my-tmp/
$ # it presents as a root owned folder but doesn't allow chown/chmods 
I have no name!@664436f5a386:/my-tmp$ ls -al
total 4
drwxr-xr-x 2 root root    0 Apr 10 20:44 .
drwxr-xr-x 1 root root 4096 Apr 10 20:47 ..
$ # and doesn't respect the permissions that it presents
I have no name!@664436f5a386:/my-tmp$ touch foo
I have no name!@664436f5a386:/my-tmp$ ls -l
total 0
-rwxr-xr-x 1 root root 0 Apr 10 20:48 foo
I have no name!@664436f5a386:/my-tmp$
@csandanov

This comment has been minimized.

Copy link

csandanov commented Apr 11, 2018

@yosifkit the same problem exists with Docker for Mac

@niko44

This comment has been minimized.

Copy link

niko44 commented Apr 12, 2018

Hello,

It's incredible that the problem persists for a year and nobody has managed to find a solution!
MariaDb / docker are not compatible when we need to map a volume to the host? Which is the more important thing for a container like a database.

@tianon

This comment has been minimized.

Copy link
Member

tianon commented Apr 12, 2018

Docker and MariaDB work fine together; the bit that doesn't work is the custom filesystem employed by Docker for Windows and Docker for Mac for sharing files across the VM boundary, which is not all that surprising for a database, which often use features like mmap for performance but thus also require support from the underlying filesystem. There are many reports of similar issues with vboxsf, for example.

@lucasmontec

This comment has been minimized.

Copy link

lucasmontec commented Apr 13, 2018

Are there any requests to solve this behaviour? How would you recommend working with them toghether then?

@tianon

This comment has been minimized.

Copy link
Member

tianon commented Apr 13, 2018

Any fixes would have to happen either in Docker's shared filesystem or in MariaDB itself (not something we can really fix in this Docker image), so I'd recommend checking their respective upstream bugtrackers for any discussion of fixing the problem.

@csandanov

This comment has been minimized.

Copy link

csandanov commented Apr 25, 2018

Reported in MariaDB's JIRA: https://jira.mariadb.org/browse/MDEV-16015

@niko44

This comment has been minimized.

Copy link

niko44 commented Apr 26, 2018

Thks a lot^^ @csandanov

@seangwright

This comment has been minimized.

Copy link

seangwright commented May 9, 2018

I ran into this issue recently when trying to use a newer image of MariaDB. I tried upgrading to 10.2-3.1.3 but I encountered the issue in this thread.

I then rolled back to 10.1-2.1.0 and the issue was gone.

I am using Docker Version 18.03.1-ce-win65 (17513)
Channel: stable
93354b3

@darkguy2008

This comment has been minimized.

Copy link

darkguy2008 commented May 24, 2018

Alright, for those who don't like to spend 2+ hours around this issue like I did, here's what fixed it for me (Windows 10, Docker with Hyper-V):

docker-compose.yml:

version: "3"
services:

  db:
    image: mariadb:10.1
    restart: unless-stopped
    volumes:
      - ./config:/etc/mysql/conf.d
      - ./data:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=xxxxxxx
      - MYSQL_PASSWORD=xxxxxxx
      - MYSQL_DATABASE=xxxxxxx
      - MYSQL_USER=xxxxxxx
    command:
      mysqld --innodb-flush-method=littlesync --innodb-use-native-aio=OFF --log_bin=ON

conf.d/local.cnf

[mysqld]
innodb_flush_method=littlesync
innodb_use_native_aio=OFF
log_bin=ON

Please fix this ASAP!

@Boycce

This comment has been minimized.

Copy link

Boycce commented May 27, 2018

Still receiving this error on Docker for Windows. Fix above didn't work for me @darkguy2008
Mariadb: 10.3.7
Docker version: 18.03.1-ce, build 9ee9f40

Initializing database
2018-05-27 23:36:07 0 [Warning] InnoDB: Retry attempts for writing partial data failed.
2018-05-27 23:36:07 0 [ERROR] InnoDB: Write to file ./ibdata1 failed 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.
2018-05-27 23:36:07 0 [ERROR] InnoDB: Error number 22 means 'Invalid argument'
2018-05-27 23:36:07 0 [ERROR] InnoDB: Could not set the file size of './ibdata1'. Probably out of disk space

@udhayapps

This comment has been minimized.

Copy link

udhayapps commented Jul 5, 2018

@darkguy2008 solution worked for me on Windows 8.1 Pro - Docker Toolbox. Wasted 2 hours anyway :(
Mariadb: 10.1.34
Docker version: 18.03.1-ce, build 9ee9f40

@heesubsong

This comment has been minimized.

Copy link

heesubsong commented Jul 6, 2018

same here

고쳐주세요

@vzakusylo

This comment has been minimized.

Copy link

vzakusylo commented Jul 7, 2018

got error (

command
docker run --name mariadb -d -v D:\Projects\docker\docker-qub:/var/lib/mysql -e MYSQL_USER=user -e MYSQL_PASSWORD=password -e MYSQL_DATABASE=address -e MYSQL_ROOT_PASSWORD=password mariadb

docker logs f7e30
2018-07-07 18:54:11 0 [Note] mysqld (mysqld 10.3.8-MariaDB-1:10.3.8+maria~jessie) starting as process 1 ...
2018-07-07 18:54:11 0 [Note] InnoDB: Using Linux native AIO
2018-07-07 18:54:11 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-07-07 18:54:11 0 [Note] InnoDB: Uses event mutexes
2018-07-07 18:54:11 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2018-07-07 18:54:11 0 [Note] InnoDB: Number of pools: 1
2018-07-07 18:54:11 0 [Note] InnoDB: Using SSE2 crc32 instructions
2018-07-07 18:54:11 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
2018-07-07 18:54:11 0 [Note] InnoDB: Completed initialization of buffer pool
2018-07-07 18:54:11 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-07-07 18:54:11 0 [ERROR] InnoDB: The Auto-extending innodb_system data file './ibdata1' is of a different size 0 pages than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages!
2018-07-07 18:54:11 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2018-07-07 18:54:11 0 [Note] InnoDB: Starting shutdown...
2018-07-07 18:54:11 0 [ERROR] Plugin 'InnoDB' init function returned error.
2018-07-07 18:54:11 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-07-07 18:54:11 0 [Note] Plugin 'FEEDBACK' is disabled.
2018-07-07 18:54:11 0 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
2018-07-07 18:54:11 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2018-07-07 18:54:11 0 [ERROR] Aborting

docker ps
f7e30a92ad33 mariadb "docker-entrypoint.s…" 3 minutes ago Exited (1) About a minute ago

docker info
Containers: 68
Running: 28
Paused: 0
Stopped: 40
Images: 47
Server Version: 18.03.1-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: active
NodeID: umg8s7ejhmcybmvotfukeyr82
Is Manager: true
ClusterID: 9nvcjrfg2x4g1vcjf53pj49q5
Managers: 1
Nodes: 1
Orchestration:
Task History Retention Limit: 5
Raft:
Snapshot Interval: 10000
Number of Old Snapshots to Retain: 0
Heartbeat Tick: 1
Election Tick: 10
Dispatcher:
Heartbeat Period: 5 seconds
CA Configuration:
Expiry Duration: 3 months
Force Rotate: 0
Autolock Managers: false
Root Rotation In Progress: false
Node Address: 192.168.65.3
Manager Addresses:
192.168.65.3:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 773c489c9c1b21a6d78b5c538cd395416ec50f88
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.87-linuxkit-aufs
Operating System: Docker for Windows
OSType: linux
Architecture: x86_64
CPUs: 3
Total Memory: 4.569GiB
Name: linuxkit-00155d006a66
ID: MPAV:XNLY:FH2E:XCK4:KCUE:C647:3JMR:43PM:LR5A:ECCI:WFHS:RDLT
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 84
Goroutines: 210
System Time: 2018-07-07T19:08:46.9034987Z
EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

@yosifkit

This comment has been minimized.

Copy link
Member

yosifkit commented Jul 25, 2018

@vzakusylo, We recently added #168 which should make sharing a directory from a windows host possible. Try the following (I don't have a host with Docker for Windows at the moment, but it worked when I last checked):

$ # also updated to specify a version of mariadb so that things don't break when latest becomes 10.4
$ docker run --name mariadb -d -v D:\Projects\docker\docker-qub:/var/lib/mysql -e MYSQL_USER=user -e MYSQL_PASSWORD=password -e MYSQL_DATABASE=address -e MYSQL_ROOT_PASSWORD=password mariadb:10.3 --innodb-flush-method=fsync

For future users that are using docker-compose it would be adding --innodb-flush-method=fsync to the command.

@peter-gribanov

This comment has been minimized.

Copy link

peter-gribanov commented Aug 7, 2018

@yosifkit thanks for this. It works for me.

My docker-compose.yml

version: '3.1'

services:
  mariadb:
    image: mariadb:10.3
    volumes:
      - ./docker/mariadb:/docker-entrypoint-initdb.d/
      - ./var/mariadb:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: '${MYSQL_ROOT_PASSWORD}'
      MYSQL_DATABASE: '${MYSQL_DATABASE}'
      MYSQL_USER: '${MYSQL_USER}'
      MYSQL_PASSWORD: '${MYSQL_PASSWORD}'
    ports:
      - '${MYSQL_PORT:-3306}:3306'
    command:
      'mysqld --innodb-flush-method=fsync'
@TomNolane

This comment has been minimized.

Copy link

TomNolane commented Aug 26, 2018

@darkguy2008 Very Thanks! It's work!!

berni2288 added a commit to gentics/cms-compose that referenced this issue Sep 13, 2018

Update docker-compose.yml
Fix MariadB initialization problem with Windows hosts

docker-library/mariadb#95
@AdsonCicilioti

This comment has been minimized.

Copy link

AdsonCicilioti commented Nov 5, 2018

@darkguy2008 Nice temp solution! @yosifkit thanks for all!
Waiting for a solid solution on future versions...

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