here are multiple "hackish" ways to do it:

scan kernel logs, as mentioned by Jiri (but you have to do it right after starting the container, otherwise it gets messy);
    check the interface counters (sent/received packets/bytes) in the container, then compare with the interfaces in the host, and find the pair that matches exactly (but with sent and receive directions flipped);
    use an iptables LOG rule.

The last option is, IMHO, the more reliable one (and the easiest to use), but it's still very hackish. The idea is very simple:

Add an iptables rule to log e.g. ICMP traffic arriving on the Docker bridge:

sudo iptables -I INPUT -i docker0 -p icmp -j LOG

Send a ping to the container you want to identify:

IPADDR=$(docker inspect -f='{{.NetworkSettings.IPAddress}}' d6ed83a8e282)

ping -c 1 $IPADDR

Check kernel logs:

dmesg | grep $IPADDR

You will see a line looking like this:

[…] IN=docker0 OUT= PHYSIN=vethv94jPK MAC=fe:2c:7f:2c:ab:3f:42:83:95:74:0b:8f:08:00 SRC=172.17.0.79 …

If you want to be fancy, just extract PHYSIN=… with awk or sed.

Remove the iptables logging rule (unless you want to leave it there because you will regularly ping containers to identify them).

iptables -I INPUT -i docker0 -p tcp --dport 9200  -j ACCEPT

centos7 iptables/firewalld docker open port的更多相关文章

  1. Centos7 iptables firewalld防火墙与selinux配置

    一.iptables防火墙 1.基本操作 # 查看防火墙状态 service iptables status # 停止防火墙 service iptables stop # 启动防火墙 service ...

  2. Linux防火墙配置(iptables, firewalld)

    netfilter和底层实现 iptables firealld Linux中的防火墙 RHEL中有几种防火墙共存: iptables firewalld ip6tables ebtables 这些软 ...

  3. centos7.7下docker与k8s安装(DevOps三)

    1.系统配置 centos7.7 docker 1.13.1 centos7下安装docker:https://www.cnblogs.com/pu20065226/p/10536744.html 2 ...

  4. Linux防火墙(iptables/firewalld)

    Linux防火墙(iptables/firewalld) 目录 Linux防火墙(iptables/firewalld) 一.iptables 1. iptables概述 2. netfilter和i ...

  5. 在centos7上用docker安装宝塔面板

    在centos7上用docker安装宝塔面板   1. [root@web01 ~]# systemctl enable docker 2. [root@web01 ~]# docker pull c ...

  6. Docker - 在CentOS7中安装Docker

    在CentOS 7中安装Docker 1-确认系统信息 # cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) # uname - ...

  7. CentOS7使用firewalld打开关闭防火墙与端口(转载)

    1.firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld 停止: systemctl disabl ...

  8. Centos7下卸载docker

    最近发现某台机器上的Docker服务无法开启,报如下错误: [root@localhost ~]# docker ps -a Cannot connect to the Docker daemon. ...

  9. centos7系统下 docker 环境搭建

    运行环境: VMware Workstation Pro 在虚拟机中安装centos7系统, 选择最小安装, 网络连接方式选择的桥接(与宿主机在同一IP段)centos7一定要安装64位, docke ...

随机推荐

  1. C++字符串类型和数字之间的转换

    转载:http://www.cnblogs.com/luxiaoxun/archive/2012/08/03/2621803.html 1.字符串数字之间的转换 字符串---字符数组(1)string ...

  2. 使用Java程序片段动态生成表格

    <% String[] bookName = { "javaweb典型模块大全", "java从入门到放弃", "C语言程序设计" } ...

  3. UltraEdit-32 查看编码

    一直苦于无法判断文件的编码类型,现在发现一个方法,就是用强大的UltraEdit-32软件: UltraEdit-32的状态栏可以显示文件的编码类型,详细情况如下: ANSCI------------ ...

  4. 移动端 touch

    原文链接:http://caibaojian.com/mobile-touch-event.html 本文主要介绍 TouchEvent 相关的一些对象与属性如 Touch, TouchList, t ...

  5. BIEE物理业务层编辑之后发布路径

    在BI 业务逻辑层编辑之后,需要发布,地址是http://pc201411260149:7001/em/, IP/em 在business intelligence 页面,点击部署,然后选择文件发布

  6. NHibernate之映射文件配置说

    1. hibernate-mapping 这个元素包括以下可选的属性.schema属性,指明了这个映射所引用的表所在的schema名称.假若指定了这个属性, 表名会加上所指定的schema的名字扩展为 ...

  7. TCP处理主要开销

    快速的网络TCP 通常受限 发送主机 与 接收主机. 而不是网络设备或协议本身的实现. TCP的处理的主要开销 分为中断操作.数据复制和协议处理. 1:中断操作 2:数据复制 3:协议处理 TCP的处 ...

  8. Serlvet学习笔记之二—不同页面共享数据

    一共有四种方法实现共享页面共享数据 1.cookie 2.sendRedirect 3.session 4.隐藏表单提交(form) 5.ServletContex 1.cookie:服务器在客户端保 ...

  9. 高性能LAMP程序设计

    高性能LAMP程序设计 原文地址: http://www.infoq.com/cn/presentations/fcq-high-performance-lamp-programming 演讲稿: h ...

  10. solr删除数据的4种方便快捷的方式

    1.在solr客户端,访问你的索引库(我认为最方便的方法) 1)documents type 选择 XML  2)documents 输入下面语句 <delete><query> ...