添加 tcpdump docker 镜像,基础镜像节点:10.0.0 [英] Add tcpdump docker image with base image node:10.0.0

查看:42
本文介绍了添加 tcpdump docker 镜像,基础镜像节点:10.0.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果基础镜像是node:10.0.0

Dockerfile:

FROM node:10.0.0
EXPOSE $SERVICE_PORT
USER node
RUN mkdir -p /home/node/
WORKDIR /home/node/
COPY package.json /home/node/
RUN npm install
COPY . /home/node/
CMD ["npm", "run", "staging"]

我想跟踪此容器中的流量.

I want to trace the traffic in this container.

推荐答案

不需要修改你的镜像就可以访问容器的网络.您可以在同一网络命名空间中运行第二个容器:

It is unnecessary to modify your image to access the network of the container. You can run a second container in the same network namespace:

docker run -it --net container:${container_to_debug}  nicolaka/netshoot 

从那里,您可以运行 tcpdump 和各种其他网络调试工具,并查看流向其他容器的流量.要查看 netshoot 中包含的所有工具,请参阅 github 存储库:https://github.com/nicolaka/netshoot

From there, you can run tcpdump and a variety of other network debugging tools and see the traffic going to your other container. To see all the tools included in netshoot, see the github repo: https://github.com/nicolaka/netshoot

这篇关于添加 tcpdump docker 镜像,基础镜像节点:10.0.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆