Docker容器启动报WARNING: IPv4 forwarding is disabled. Networking will not work
[root@summer prometheus]# docker run -d -p 9100:9100 -v "/proc:/host/proc:ro" -v "/sys:/host/sys:ro" -v "/:/rootfs:ro" prom/node-exporter
WARNING: IPv4 forwarding is disabled. Networking will not work.
86c35154262b332d1f2f3425fde25840f43fdc3a1cef66a2010608af4b6ce736
添加net.ipv4.ip_forward=1
重启网络即可
[root@summer prometheus]# vim /etc/sysctl.conf
[root@smartops42 prometheus]# cat /etc/sysctl.conf
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
net.ipv4.ip_forward = 0
net.ipv4.ip_local_port_range = 1025 65535
vm.max_map_count=655360
fs.file-max=655360
net.ipv4.ip_forward=1
[root@summer prometheus]# systemctl restart network
[root@summer prometheus]# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1
[root@summer prometheus]#