美文网首页
查看容器的IP地址,可以在主机上运行

查看容器的IP地址,可以在主机上运行

作者: hp002277wl | 来源:发表于2017-01-18 17:08 被阅读0次

sudoDockerps查看正在运行的容器的id等信息

”sudo docker inspect 容器id“可以查看到容器的相关信息

“docker inspect --format '{{ .NetworkSettings.IPAddress }}' 容器id”可以查看容器的具体IP地址,如果输出是空的说明没有配置IP地址

ifconfig查看主机上的网络

cat /etc/hosts查看主机内部IP映射表

cat /etc/resolv.conf查看主机dns服务器配置

cat /etc/nsswitch.conf查看主机名字服务配置,这个配置文件用来在/etc/hosts文件中查找主机名和IP地址,如果在hosts文件中没有找到给定的主机的话,就会和DNS服务器通讯。

其他可能的名字服务会联系LDAP,NIS和NIS+等。

ip addr show查看主机IP地址

ip route show查看主机转发信息

netstat -nr查看主机当前IP转发表详细信息

在容器内可以查看网络相关的信息

ifconfig查看容器内的网络

cat /etc/hosts查看容器内内部IP映射表

cat /etc/resolv.conf查看容器内dns服务器配置

cat /etc/nsswitch.conf查看容器名字服务配置

ip addr show查看容器IP地址

ip route show查看容器转发信息

netstat -nr查看容器当前IP转发表详细信息

查看iptables:

sudo iptables -L -v

如果没有装iptables:

sudo apt-get install iptables

另外还有一些其他辅助命令:

参考http://www.tecmint.com/Linux-network-configuration-and-troubleshooting-commands/

hostwww.baidu.com

host -t any baidu.com

ping baidu.com

/usr/sbin/traceroutewww.baidu.com

whois baidu.com

digwww.tecmint.com; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.10.rc1.el6 <<>>www.tecmint.com

nslookupwww.tecmint.com

arp -e

ethtool eth0

iwconfig [interface]

cat /etc/sysconfig/network

相关文章

网友评论

      本文标题:查看容器的IP地址,可以在主机上运行

      本文链接:https://www.haomeiwen.com/subject/lpkbbttx.html