我基于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
但是如果我启动 Docker 容器时不加上 --privileged
参数,那就没问题了。为什么呢?
But when I start the Docker container without --privileged
, it is ok. why?
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 <xxx@gmail.com>
RUN apt-get update \
&& apt-get install -y python \
python-dev \
tcpdump
RUN pip2 install scapy \
&& pip2 install rpyc \
&& pip2 install robotremoteserver \
&& pip2 install daemonocle