错误集——docker构建镜像时,yum安装卡住
[root@promote /home/docker-lic-volume] # vim mydockerfile
FROM centos
MAINTAINER lic<[email protected]>
ENV MYPATH /usr/local
WORKDIR $MYPATH
RUN yum -y install vim
RUN yum -y install net-tools
EXPOSE 80
CMD echo $MYPATH
CMD echo "----end----"
CMD /bin/bash
[root@promote /home/docker-lic-volume] # docker build -f /home/docker-lic-volume/mydockerfile -t mycentos:1.0 .
Sending build context to Docker daemon 2.048kB
Step 1/10 : FROM centos
---> 300e315adb2f
Step 2/10 : MAINTAINER lic<[email protected]>
---> [Warning] IPv4 forwarding is disabled. Networking will not work.
---> Running in 9c9a4fd38b8d
Removing intermediate container 9c9a4fd38b8d
---> 2f7ee6776d3b
Step 3/10 : ENV MYPATH /usr/local
---> [Warning] IPv4 forwarding is disabled. Networking will not work.
---> Running in 154cf565aec9
Removing intermediate container 154cf565aec9
---> 5a3243d0aab5
Step 4/10 : WORKDIR $MYPATH
---> [Warning] IPv4 forwarding is disabled. Networking will not work.
---> Running in 651c60b56030
Removing intermediate container 651c60b56030
---> 728bae31dac0
Step 5/10 : RUN yum -y install vim
---> [Warning] IPv4 forwarding is disabled. Networking will not work.
---> Running in e215cc74ad99
^C
告警:ip转发功能未打开,网络将无法生效
解决方法:配置内核参数文件/etc/sysctl.conf,开启ip转发功能
echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
sysctl -p