执行  docker run  时遇到如下WARNING:

[root@etcd1 volumes]# docker run -d -p 8080:80 -v /tmp/test_mount httpd
Unable to find image 'httpd:latest' locally
Trying to pull repository docker.io/library/httpd ...
sha256:72f2b4aa99235509146bd12054d1a93c1c869ba60212d21729118c93ca4305d3: Pulling from docker.io/library/httpd
3d77ce4481b1: Pull complete
73674f4d9403: Pull complete
d266646f40bd: Pull complete
ce7b0dda0c9f: Pull complete
01729050d692: Pull complete
014246127c67: Pull complete
7cd2e04cf570: Pull complete
Digest: sha256:72f2b4aa99235509146bd12054d1a93c1c869ba60212d21729118c93ca4305d3
Status: Downloaded newer image for docker.io/httpd:latest
WARNING: IPv4 forwarding is disabled. Networking will not work.
a281f3580d29863a472a3d8c5945a07c0b9d485dcd49f50b3816ff6406e44513

查看 IPv4 forwarding 启用情况

[root@etcd1 volumes]# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 0

  

解决方案:

方案1

(1)查看forward转发是否开启:

## 内核中的forward功能开启
[root@etcd1 volumes]# cat /proc/sys/net/ipv4/ip_forward
0
## 或者
[root@etcd1 volumes]# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 0

  

(2)设置生效

[root@etcd1 volumes]# echo "1" > /proc/sys/net/ipv4/ip_forward

## 或者
[root@etcd1 volumes]# sysctl -w net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1

 

(3)查看是否生效:

[root@etcd1 volumes]# cat /proc/sys/net/ipv4/ip_forward
1
## 或者
[root@etcd1 volumes]# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1

 

上述方式,可以达到立即生效的效果,但是重启网络服务之后,就会失效,所以,这种情况可以用于调试。

方案2: 

(1)设置生效:

[root@etcd1 volumes]# echo net.ipv4.ip_forward=1 >> /usr/lib/sysctl.d/00-system.conf  ## 或者 /etc/sysctl.conf
[root@etcd1 volumes]# systemctl restart network

(2)查看是否修改成功:

[root@etcd1 volumes]# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1 

重启docker服务:

[root@etcd1 volumes]# systemctl restart docker

  

完成!

  

docker run 报错——WARNING: IPv4 forwarding is disabled. Networking will not work.的更多相关文章

  1. docker 启动报错 WARNING: IPv4 forwarding is disabled. Networking will not work.

    解决办法: # vi /etc/sysctl.conf 或者 # vi /usr/lib/sysctl.d/00-system.conf 添加如下代码:     net.ipv4.ip_forward ...

  2. Docker报错 WARNING: IPv4 forwarding is disabled. Networking will not work.

    问题:创建容器的时候报错WARNING: IPv4 forwarding is disabled. Networking will not work. # docker run -it -p 3000 ...

  3. Docker运行程序报错 WARNING: IPv4 forwarding is disabled. Networking will not work

    WARNING: IPv4 forwarding is disabled. Networking will not work.   第一步:vi /usr/lib/sysctl.d/00-system ...

  4. 解决报错WARNING: IPv4 forwarding is disabled. Networking will not work.

    报错: [root@localhost /]# docker run -it ubuntu /bin/bash WARNING: IPv4 forwarding is disabled. Networ ...

  5. 【docker】 追加端口映射时 报错 WARNING: IPv4 forwarding is disabled. Networking will not work.

    解决办法: vi /etc/sysctl.conf 添加如下代码: net.ipv4.ip_forward= 重启network服务 systemctl restart network 查看: sys ...

  6. docker启动容器报错:IPv4 forwarding is disabled. Networking will not work

    报这个错误会导致宿主机以外的pc 访问不了容器 按照网上的解决办法: 在/usr/lib/sysctl.d/00-system.conf文件后加net.ipv4.ip_forward=1 即可 然后重 ...

  7. Docker 问题[Warning] IPv4 forwarding is disabled. Networking will not work.

    Docker 问题[Warning] IPv4 forwarding is disabled. Networking will not work. 在使用Dockerfile创建Docker镜像的时候 ...

  8. Docker报错:“WARNING: IPv4 forwarding is disabled. Networking will not work.”解决。

    问题阐述 一次停电之后,服务器停机,然后ip莫名被占用,修改新的ip之后,ssh能够连接上去,但是web服务访问不了,数据库访问不了,除了22端口,其它服务端口都不能telnet. 防火前.IPtab ...

  9. Docker:docker创建容器时报错:WARNING: IPv4 forwarding is disabled. Networking will not work.

    创建容器时报错: WARNING: IPv4 forwarding is disabled. Networking will not work. # docker run -it -p 30001:2 ...

随机推荐

  1. ubuntu12.04 ppa安装git

    PPA地址:https://launchpad.net/~git-core/+archive/ppa 支持所有的Ubuntu版本. 运行命令: sudo apt-add-repository ppa: ...

  2. Linux学习-软件磁盘阵列 (Software RAID)

    什么是 RAID 磁盘阵列全名是『 Redundant Arrays of Inexpensive Disks, RAID 』,英翻中的意思是:容错式廉价磁盘阵列.RAID 可以透过一个技术(软件或硬 ...

  3. UVa 1407 树形背包 Caves

    这道题可以和POJ 2486 树形背包DP Apple Tree比较着来做. 参考题解 #include <iostream> #include <cstdio> #inclu ...

  4. 前端PS切图技巧

    先选择“编辑”-“首选项” 打开,找到“参考线”    设置一下每格网格 100像素 5个细块 确定后 ctrl+‘ 出现网格.(通过网格对齐切图比用参考线切图更好). 如果使用PS cc的软件的话, ...

  5. python中json操作了解

    什么是接口? 交换数据 http://openweathermap.org/current json简介 JSON 是存储和交换文本信息的语法.类似 XML JSON 语法是 JavaScript 语 ...

  6. 浅析win32 Win64 x86 x64 区别 及Eclipse启动报Java was started but returned exit code=13 错误

    win32.x86_64是64位 X86就是  32位系统 X64 就是64位系统 最好记得方法就是带有64的就是64位,其余都是32位 为什么要讲这个呢? 如果是绿色版本的eclipse,在打开ec ...

  7. request.getHeader("referer")

    在开发web程序的时候,有时我们需要得到用户是从什么页面连过来的,这就用到了referer. 它是http协议,所以任何能开发web程序的语言都可以实现,比如jsp中是: request.getHea ...

  8. 快速samba配置

      apt-get install samba   smbpasswd -a user 如果需要写权限 [homes] read only = no

  9. hihoCoder #1117 战争年代

    题目大意 对一棵树的节点染色.初始时每个点都染成颜色 $0$,然后进行 $m$ 轮操作.第 $i$ 轮操作:从 $[0,d_i]$ 中随机选出一个整数 $d$,将距离点 $x_i$ 不超过 $d$ 的 ...

  10. 区间合并 POJ3667+HDU4553

    两道题都是线段树的区间合并 lsum, rsum分别表示左/右端点 开始向右/左 符合条件的元素的最长连续长度 sum表示这个区间的符合条件的元素的最长连续长度 所以pushUp可写: void pu ...