在这个Dockerfile中运行mysqld时(在我的Linux机器上,Linux 12.04)
Dockerfile:
FROM ubuntu:precise
RUN apt-get update
RUN apt-get install -y MysqL-server
CMD ["/usr/sbin/MysqLd"]
我在加载共享库时遇到MysqLd:error:libz.so.1:无法打开共享对象文件:权限被拒绝
而通过boot2docker在我的Mac上运行MysqLd启动就好了.
我尝试了不同的基础docker图像:
> phusion / baseimage:0.9.8
> phusion / baseimage:0.9.1
> ubuntu:最新
我在主机系统上运行了apt-get update和apt-get upgrade(包括更新MysqL),我已经重新启动了主机系统.
关于如何进行的任何想法?
关于我的系统的信息:
$docker version
Client version: 0.9.0
Go version (client): go1.2.1
Git commit (client): 2b3fdf2
Server version: 0.9.0
Git commit (server): 2b3fdf2
Go version (server): go1.2.1
Last stable version: 0.9.0
$docker info
Containers: 37
Images: 340
Driver: aufs
Root Dir: /var/lib/docker/aufs
Dirs: 414
WARNING: No swap limit support
$uname -a
Linux Ubuntu-1204-precise-64-minimal 3.8.0-37-generic #53~precise1-Ubuntu SMP Wed Feb 19 21:37:54 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
回答leeduhem关于libz.so.1权限的评论:
$ls -l /lib/x86_64-linux-gnu/libz.so.1
lrwxrwxrwx 1 root root 15 Nov 10 2011 /lib/x86_64-linux-gnu/libz.so.1 -> libz.so.1.2.3.4
$ls -l /lib/x86_64-linux-gnu/libz.so.1.2.3.4
-rw-r--r-- 1 root root 92720 Nov 10 2011 /lib/x86_64-linux-gnu/libz.so.1.2.3.4
使用更改权限
$chmod +x /lib/x86_64-linux-gnu/libz.so.1.2.3.4
我仍然得到错误.
运行strace -o /tmp/MysqL.strace MysqLd和cat /tmp/MysqL.strace给出
execve("/usr/sbin/MysqLd",["MysqLd"],[/* 7 vars */]) = 0
brk(0) = 0x7f4d41f7c000
access("/etc/ld.so.nohwcap",F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 0x7f4d403c5000
access("/etc/ld.so.preload",R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache",O_RDONLY|O_CLOEXEC) = -1 EACCES (Permission denied)
open("/lib/x86_64-linux-gnu/tls/x86_64/libz.so.1",O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/x86_64-linux-gnu/tls/x86_64",0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/tls/libz.so.1",O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/x86_64-linux-gnu/tls",0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/x86_64/libz.so.1",O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/x86_64-linux-gnu/x86_64",0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libz.so.1",O_RDONLY|O_CLOEXEC) = -1 EACCES (Permission denied)
stat("/lib/x86_64-linux-gnu",0x7fff713907f0) = -1 EACCES (Permission denied)
open("/usr/lib/x86_64-linux-gnu/tls/x86_64/libz.so.1",O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/x86_64-linux-gnu/tls/x86_64",0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/tls/libz.so.1",O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/x86_64-linux-gnu/tls",0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/x86_64/libz.so.1",O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/x86_64-linux-gnu/x86_64",0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/libz.so.1",O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/x86_64-linux-gnu",0x7fff713907f0) = -1 EACCES (Permission denied)
open("/lib/tls/x86_64/libz.so.1",O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/tls/x86_64",0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/lib/tls/libz.so.1",O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/tls",0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/lib/x86_64/libz.so.1",O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/x86_64",0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/lib/libz.so.1",O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib",0x7fff713907f0) = -1 EACCES (Permission denied)
open("/usr/lib/tls/x86_64/libz.so.1",O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/tls/x86_64",0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/libz.so.1",O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/tls",0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64/libz.so.1",O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/x86_64",0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/usr/lib/libz.so.1",O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib",0x7fff713907f0) = -1 EACCES (Permission denied)
writev(2,[{"MysqLd",6},{": ",2},{"error while loading shared libra"...,36},{"libz.so.1",9},{"cannot open shared object file",30},{"Permission denied",17},{"\n",1}],10) = 107
查看跟踪似乎指示的目录/ lib和/ lib / x86_64-linux-gnu是不允许的:
$ls -ld /lib
drwxr-xr-x 12 root root 4096 Dec 16 13:42 /lib
$ls -ld /lib/x86_64-linux-gnu
drwxr-xr-x 3 root root 4096 Mar 17 13:39 /lib/x86_64-linux-gnu
最佳答案
原文链接:https://www.f2er.com/docker/436755.html