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. (转)windows下编译最新的x264

    二:<windows下编译最新的x264> X264更新的比较快,每天都有更新,但算法模块,基本结构是没有多大变化的.x264都是用C语言写的包括C99,但C99语法是在VC中是没法用的( ...

  2. (转) 从ffmpeg中提取出YUV数据

    有时需要从ffmpeg中提取出YUV数据用作预览,另存什么的. ffmpeg是先解码成YUV, 再以这个YUV作为输入进行编码,所以YUV数据有两种:  解码后的YUV数据, 以及  编码重建的YUV ...

  3. MySQL无法远程连接解决方案

    1.查看/etc/mysql/my.cnf配置文件是否只允许本地连接 注释配置:#bind-address = 127.0.0.1,重启MySQL Server 2.防火墙(我用的是iptables) ...

  4. org.xml.sax.SAXParseException: prolog 中不允许有内容

    org.xml.sax.SAXParseException: prolog 中不允许有内容 digester.fatalError 不下心踢了电源导致的错误应该是解析xml出问题,找了半天不知道哪个x ...

  5. Tomcat源码学习

    Tomcat源码学习(一) 转自:http://carllgc.blog.ccidnet.com/blog-htm-do-showone-uid-4092-type-blog-itemid-26309 ...

  6. json_encode用法

    1.从数据库中查询出来的数据,放在数组中 $query=mysql_query($SQL); while($row = mysql_fetch_array($query)){         $xda ...

  7. 【java】java内存模型(2)--volatile内存语义详解

    多线程并发编程中synchronized和Volatile都扮演着重要的角色,Volatile是轻量级的synchronized,它在多处理器开发中保证了共享变量的“可见性”.可见性的意思是当一个线程 ...

  8. Linux select 机制深入分析

    Linux select 机制深入分析            作为IO复用的实现方式.select是提高了抽象和batch处理的级别,不是传统方式那样堵塞在真正IO读写的系统调用上.而是堵塞在sele ...

  9. POJ 3211 Washing Cloths(01背包变形)

    Q: 01背包最后返回什么 dp[v], v 是多少? A: 普通01背包需要遍历, 从大到小. 但此题因为物品的总重量必定大于背包容量, 所以直接返回 dp[V] 即可 update 2014年3月 ...

  10. Python 爬虫知识点 - 淘宝商品检索结果抓包分析

    一.抓包基础 在淘宝上搜索“Python机器学习”之后,试图抓取书名.作者.图片.价格.地址.出版社.书店等信息,查看源码发现html-body中没有这些信息,分析脚本发现,数据存储在了g_page_ ...