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

mount as user mysql #30

Closed
note89 opened this issue Nov 4, 2015 · 6 comments
Closed

mount as user mysql #30

note89 opened this issue Nov 4, 2015 · 6 comments

Comments

@note89
Copy link

note89 commented Nov 4, 2015

Hello i would like to mount a volume as another user than root.
but mysql does not has access to chown: cannot read directory '/var/lib/mysql/': Permission denied

@yosifkit
Copy link
Contributor

Yes, the data directory is chowned to the mysql user before mysqld is started. This does not work on Macs where the directory is actually a share through vboxsf. Some solutions are discussed in boot2docker/boot2docker#581. If you are in this boat of being unable to change the ownship of the directory that gets bind-mounted, I would think the easiest (without using the experimental user namespaces) would be to create an image FROM mariadb:10 that changes the user id of the mysql user.

@motin
Copy link

motin commented Jan 7, 2016

I tried using the same workaround for OSX that worked with the mysql docker image, which makes mysql able to write in the mounted directories. MariaDB however crashes for some other reason:

$ docker-compose logs mariadb
Attaching to debiannginxphpdatabasetestapp_mariadb_1
mariadb_1 | * Working around permission errors locally by making sure that "mysql" uses the same uid and gid as the host volume
mariadb_1 | -- Setting mysql user to use uid 1000
mariadb_1 | -- Setting mysql group to use gid 50
mariadb_1 |
mariadb_1 | * Starting MariaDB
mariadb_1 | 2016-01-07 10:44:09 140515454482368 [Note] mysqld (mysqld 10.1.10-MariaDB-1~jessie) starting as process 20 ...
mariadb_1 | 2016-01-07 10:44:09 140515454482368 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
mariadb_1 | 2016-01-07 10:44:09 140515454482368 [Note] InnoDB: Using mutexes to ref count buffer pool pages
mariadb_1 | 2016-01-07 10:44:09 140515454482368 [Note] InnoDB: The InnoDB memory heap is disabled
mariadb_1 | 2016-01-07 10:44:09 140515454482368 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mariadb_1 | 2016-01-07 10:44:09 140515454482368 [Note] InnoDB: Memory barrier is not used
mariadb_1 | 2016-01-07 10:44:09 140515454482368 [Note] InnoDB: Compressed tables use zlib 1.2.8
mariadb_1 | 2016-01-07 10:44:09 140515454482368 [Note] InnoDB: Using Linux native AIO
mariadb_1 | 2016-01-07 10:44:09 140515454482368 [Note] InnoDB: Using SSE crc32 instructions
mariadb_1 | 2016-01-07 10:44:09 140515454482368 [Note] InnoDB: Initializing buffer pool, size = 256.0M
mariadb_1 | 2016-01-07 10:44:10 140515454482368 [Note] InnoDB: Completed initialization of buffer pool
mariadb_1 | 2016-01-07 10:44:10 140515454482368 [Warning] InnoDB: Failed to set O_DIRECT on file ./ibdata1: OPEN: Invalid argument, continuing anyway. O_DIRECT is known to result in 'Invalid argument' on Linux on tmpfs, see MySQL Bug#26662.
mariadb_1 | 2016-01-07 10:44:10 140515454482368 [Note] InnoDB: Highest supported file format is Barracuda.
mariadb_1 | 2016-01-07 10:44:10 140515454482368 [Note] InnoDB: 128 rollback segment(s) are active.
mariadb_1 | 2016-01-07 10:44:10 140515454482368 [Note] InnoDB: Waiting for purge to start
mariadb_1 | 2016-01-07 10:44:10 140515454482368 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.26-76.0 started; log sequence number 1600729
mariadb_1 | 2016-01-07 10:44:10 140514670118656 [Note] InnoDB: Dumping buffer pool(s) not yet started
mariadb_1 | 2016-01-07 10:44:10 140515454482368 [Note] Plugin 'FEEDBACK' is disabled.
mariadb_1 | 2016-01-07 10:44:10 140515454482368 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
mariadb_1 | 2016-01-07 10:44:10 140515454482368 [Note] Recovering after a crash using tc.log
mariadb_1 | 2016-01-07 10:44:10 140515454482368 [ERROR] Can't init tc log
mariadb_1 | 2016-01-07 10:44:10 140515454482368 [ERROR] Aborting
mariadb_1 |

For the exact implementation used, check https://github.com/neam/docker-stack/blob/9a90433a3a29ca24ad93c84f76d7245528b12e63/stacks/debian-php-nginx.database/docker-compose.yml#L105-L114 and https://github.com/neam/docker-stack/blob/9a90433a3a29ca24ad93c84f76d7245528b12e63/stacks/debian-php-nginx.database/stack/mariadb/run.sh

motin added a commit to neam/docker-stack that referenced this issue Jan 7, 2016
@shumkov
Copy link

shumkov commented Mar 16, 2016

I have the same problem as @motin. Did you find any solution?

@motin
Copy link

motin commented Mar 17, 2016

@shumkov no, and have not been actively looking due to not using MariaDB on a day-to-day basis. @note83, did you find a working solution?

@edoantonioco
Copy link

remove that tc.log file and start it again

@cfedersp
Copy link

cfedersp commented May 5, 2016

This question would be moot if pull request 50 is merged. By injecting the uid and gid into the image build, you can match the container's ownership to the host's.

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

No branches or pull requests

6 participants