Laradock: mysql + cannot change /var/lib/mysql/ ownership

Created on 9 Jun 2017  路  3Comments  路  Source: laradock/laradock

Info:

  • Docker version: 17.03.1-ce, build c6d412e
  • Laradock commit: 18b6c1b90785329ad4bff28ed5f6dcc298d2ad69
  • System info: Mac
  • System info disto/version: macOs Sierra 10.12.5

Issue:

mysql_1                | chown: changing ownership of '/var/lib/mysql/': Operation not permitted

Expected behavior:

mysql container should successfully start.


Reproduce:

Use d4m-nfs (https://github.com/IFSight/d4m-nfs)
Use LaraDock in multi site way, direcory structure:

  • BASE_DIR_PATH/laradock
  • BASE_DIR_PATH/projects
  • BASE_DIR_PATH/data

Warning:
BASE_DIR_PATH/data/mysql MUST exist since /tmp is the only directory shared by docker (see https://github.com/IFSight/d4m-nfs)

Adjust .env file as follows:
APPLICATION=../projects
DATA_SAVE_PATH=../data
PHP_VERSION=56


Relevant Code:

# start d4m-nfs
/path/to/d4m-nfs/d4m-nfs.sh

# rebuild everything
docker-compose build --no-cache nginx mysql phpmyadmin workspace php-fpm applications

# start relevant containers
docker-compose up nginx mysql phpmyadmin
Possible Bug Software Support

Most helpful comment

Specifying the user in the docker-compose.yml file worked for me.

In the MySQL / MariaDB container section add: user: mysql

All 3 comments

Specifying the user in the docker-compose.yml file worked for me.

In the MySQL / MariaDB container section add: user: mysql

@JohnAlonso Thx, it works!!!!

Specifying the user in the docker-compose.yml file worked for me.

In the MySQL / MariaDB container section add: user: mysql

thank you! you save my day.
your answer helps me to resolve a similar issue on Kubernetes.
https://kubernetes.io/docs/tasks/configure-pod-container/security-context/

Once again, thank you!

Was this page helpful?
0 / 5 - 0 ratings