我根据Ubuntu创建了一个发送应用程序的图像,并安装了tcpdump.当我使用–privileged启动容器并尝试tcpdump -i eth0时,它报告错误:
root@test:/home/test# docker run --rm -ti --privileged mytliulei/xfdsend /bin/bash
root@6199493fb2b9:/# tcpdump -i eth0
tcpdump: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: Permission denied
但是当我在没有–privileged的情况下启动Docker容器时,它没问题.为什么?
root@test:/home/test# docker run --rm -ti mytliulei/xfdsend /bin/bash
root@c7b7e2a9ec99:/# tcpdump -i eth0
tcpdump: verbose output suppressed,use -v or -vv for full protocol decode
listening on eth0,link-type EN10MB (Ethernet),capture size 65535 bytes
Docker版本:
docker version
Client version: 1.6.0
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 4749651
OS/Arch (client): linux/amd64
Server version: 1.6.0
Server API version: 1.18
Go version (server): go1.4.2
Git commit (server): 4749651
OS/Arch (server): linux/amd64
Dockerfile:
FROM ubuntu:14.04
MAINTAINER Liu Lei
最佳答案
我几天前碰到了这个错误,错误似乎与:
https://github.com/dotcloud/docker/issues/5490
一个对我有用的解决方法是移动tcpdump:
(例如,带有dockerfile的tcpdump中的mv)
RUN apt-get -y install tcpdump
RUN mv /usr/sbin/tcpdump /usr/bin/tcpdump