Skip to content

mysql:5.6 faied to start - changing ownership of '/var/lib/mysql/': Operation not permitted #187

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

Closed
libnux opened this issue Jun 30, 2016 · 6 comments

Comments

@libnux
Copy link

libnux commented Jun 30, 2016

Details below, thanks.

Command

docker run -e MYSQL_ROOT_PASSWORD=passw0rd -v ~/temp/mysql:/var/lib/mysql mysql:5.6

Error

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

OS

ubuntu 16.04 (4.4.0-25-generic #44-Ubuntu SMP Fri Jun 10 18:19:48 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux)

Docker

Server Version: 1.11.2
Storage Driver: aufs
Root Dir: /var/lib/docker/165536.165536/aufs
Backing Filesystem: extfs
Dirs: 91
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: host bridge null
Kernel Version: 4.4.0-25-generic
Operating System: Ubuntu 16.04 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.58 GiB
Name: libnux-desktop
ID: HG7F:MORL:Y7GC:VAM7:NBXD:KJAH:3MOB:MVYP:QZRU:FOK4:5CAQ:432Y
Docker Root Dir: /var/lib/docker/165536.165536
Debug mode (client): false
Debug mode (server): false
Registry: https://index.docker.io/v1/

@ltangvald
Copy link
Collaborator

Can you try adding a --user= set to a user that has the necessary permissions for /temp/mysql?

@libnux
Copy link
Author

libnux commented Jun 30, 2016

  1. added "--user=root" and still got the same error.
  2. added "--user=mysql", and failed to start since mysql user has no enough rights.

It might be caused by some change in docker 1.11.x. I could run mysql docker successfully with older docker versions.

@yosifkit
Copy link
Member

What is the uid of the owner of ~/temp/mysql, try using that.

# probably should work:
$ docker run -e MYSQL_ROOT_PASSWORD=passw0rd -v ~/temp/mysql:/var/lib/mysql --user 1000 mysql:5.6

@libnux
Copy link
Author

libnux commented Jul 4, 2016

I uninstalled docker-engine, and installed it again. Then the problem was resolved.

Thanks.

@libnux libnux closed this as completed Jul 4, 2016
@lpshikhar
Copy link

Is there any other workaround for this issues, especially running the image inside a kubernetes based framework ?

@yosifkit
Copy link
Member

@lpshikhar, I believe that the Kubernetes way is fsGroup in the securityContext: kubernetes/kubernetes#2630 (comment). But I think it depends on what persistent volume you are using.

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

No branches or pull requests

4 participants