在创建一个dockerfile,执行yum 安装时报出如下错误,

Step 3/8 : RUN yum install httpd -y
 ---> [Warning] IPv4 forwarding is disabled. Networking will not work.
 ---> Running in 9b62fa0252b1

解决办法

1.编辑 vim /etc/sysctl.conf配置文件,在最后面添加
net.ipv4.ip_forward=1
2.重启网络服务
service network restart

此时再次重新创建问题就解决了。

Step 3/8 : RUN yum install httpd -y
---> Running in 3b8b0d4962be