Skip to content
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

mysqld: Can't create/write to file '/var/lib/mysql/is_writable' (Errcode: 13 - Permission denied) #219

Closed
aarongeiser opened this issue Oct 5, 2016 · 6 comments

Comments

Projects
None yet
4 participants
@aarongeiser
Copy link

commented Oct 5, 2016

Hello -

I have been unable to get the MySQL container to initialize. I consistently get the above error. I have attempted to remove the .data folder and re-initialize the container. No luck.

The other two containers build and run fine. I have had the MySQL container run successfully once or twice - but only after a complete system restart. I have not been able to reproduce the successful running of the container - otherwise I wouldn't be posting this issue. ;)

Docker version 1.12.1, build 6f9534c
docker-machine version 0.8.1, build 41b3b25

[docker-compose.yml]

version: '2'

services:
    mysql:
        image: mysql:5.7.15
        ports:
            - 3306:3306
        volumes:
            - "./.data/db:/var/lib/mysql"
        environment:
            MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
            MYSQL_DATABASE: ${MYSQL_DATABASE}
            MYSQL_USER: ${MYSQL_USER}
            MYSQL_PASSWORD: ${MYSQL_PASSWORD}
    php:
        build: docker/php7-fpm
        ports:
            - 9000:9000
        links:
            - mysql:synthesizer
        volumes:
            - ${SYMFONY_APP_PATH}:/var/www/symfony
            - ./logs/symfony:/var/www/symfony/app/logs
    nginx:
        build: docker/nginx
        ports:
            - 80:80
        links:
            - php
        volumes_from:
            - php
        volumes:
            - ./logs/nginx/:/var/log/nginx

[docker logs]

mysql:5.7.15        "docker-entrypoint.sh"   14 seconds ago      Exited (1) 14 seconds ago

Initializing database
mysqld: Can't create/write to file '/var/lib/mysql/is_writable' (Errcode: 13 - Permission denied)
2016-10-05T04:26:41.741277Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-10-05T04:26:41.749972Z 0 [ERROR] --initialize specified but the data directory exists and is not writable. Aborting.
2016-10-05T04:26:41.750014Z 0 [ERROR] Aborting
@yosifkit

This comment has been minimized.

Copy link
Member

commented Oct 5, 2016

Since you seem to be running on OSX or Windows, add in a user: 1000:50. It defaults to running as the mysql user which is not able to access folders mounted from OSX/Windows.

@ikbenben

This comment has been minimized.

Copy link

commented Nov 16, 2016

@yosifkit I'm also experiencing this issue. Where would you specify the user: 1000:50. I assumed as a child of the mysql: image definition but htis is indicating it is invalid as it should be a string

services:
  wp_db:
    user: 1000:50
    ...

This is the output I get when I try to bring it up:

MacBook-Pro:wordpress-site brooney$ docker-compose up
ERROR: The Compose file './docker-compose.yml' is invalid because: services.wp_db.user contains an invalid type, it should be a string
@yosifkit

This comment has been minimized.

Copy link
Member

commented Nov 16, 2016

@ikbenben, It just needs some quotes around it user: "1000:50".

@yosifkit

This comment has been minimized.

Copy link
Member

commented Nov 16, 2016

This issue seems to be solved; feel free to comment if you feel it was closed in error.

@tofl

This comment has been minimized.

Copy link

commented May 31, 2019

Hello @yosifkit, I know it's an old issue but your fix doesn't seem to work for me. It did copy everything inside my volume (on my host), but this time I get another error : 2019-05-31T18:55:22.990012Z 1 [ERROR] [MY-012592] [InnoDB] Operating system error number 22 in a file operation.. Then my container stops running.

@yosifkit

This comment has been minimized.

Copy link
Member

commented May 31, 2019

@tofl, that sounds like you might need something like docker-library/mariadb#200 (comment)

i.e. docker run -d -v /host/path/:/var/lib/mysql mysql:8.0 --innodb-flush-method=O_DSYNC

I can't remember what is required to make it work (or if it will ever work), and it depends whether you are using Docker for Mac, Docker for Windows, or Boot2Docker (via Docker Toolbox).

In the future, it'd be better to post questions like this in the Docker Community Forums, the Docker Community Slack, or Stack Overflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.