(ubuntu ufw)My firewall is blocking network connections from the docker container to outside
Maybe this is due to the current version, but the current answer doesn't work on my system (Docker 0.7.2 with base Ubuntu image).
The solution is explained here in the official Docker documentation.
For the lazy ones:
edit /etc/default/ufw to change DEFAULT_FORWARD_POLICY's value to "ACCEPT",
reload with [sudo] ufw reload.
This ensures ufw forward your traffic to the Docker's bridged network (as of my current understanding of these things...).
This fixed it for me:
ufw allow in on docker0
Edit /etc/ufw/before.rules as follows:
In the *filter section, after the first block of required lines, add:
# docker rules to enable external network access from the container
# forward traffic accross the bridge
-A ufw-before-forward -i docker0 -j ACCEPT
-A ufw-before-forward -i testbr0 -j ACCEPT
-A ufw-before-forward -m state --state RELATED,ESTABLISHED -j ACCEPT
At the end of the file, after the line that says COMMIT, add the following section:
*nat
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -s 172.16.42.0/8 -o eth0 -j MASQUERADE
# don't delete the 'COMMIT' line or these rules won't be processed
COMMIT
After saving the file, restart ufw with sudo ufw disable && sudo ufw enable
(ubuntu ufw)My firewall is blocking network connections from the docker container to outside的更多相关文章
- blocking network call
[blocking network call] 阻塞的网络调用: 1.gethostbyname(): does not return until it has succeeded or failed ...
- ORA-12528: TNS:listener: all appropriate instances are blocking new connections
Oracle问题:ORA-12528: TNS: 监听程序: 所有适用例程都无法建立新连接 问题原始描述: ORA-12528: TNS:listener: all appropriate insta ...
- ubuntu ufw 配置
ubuntu ufw 配置 Ubuntu 18.04 LTS 系统中已经默认附带了 UFW 工具,如果您的系统中没有安装,可以在「终端」中执行如下命令进行安装: 1 sudo apt install ...
- Docker container network configuration
http://xmodulo.com/networking-between-docker-containers.html How to set up networking between Docker ...
- tomcat7 fail to start inside Ubuntu Docker container
The tomcat startup script needs some special privileges. Concrete it needs to check all running proc ...
- Linux之防火墙管理篇[Ubuntu:ufw]
前言 由于近期,腾讯云服务器就要到期了,学生优惠即将失效了,所以准备将数据库和项目迁移到vultr上.然而,在使用nivicat连接mysql数据库的过程中,却屡次出现:Can't connect t ...
- ubuntu ufw防火墙软件的配置入门
顺便,一条龙作完安全吧. ufw的使用,是比iptables简单.但只能作简单的事儿,更改简单的netfilter里的iptable里的记录.难点的,可能还是得iptables原生命令. 自打2.4版 ...
- ubuntu ufw防火墙
由于LInux原始的防火墙工具iptables过于繁琐,所以ubuntu默认提供了一个基于iptable之上的防火墙工具ufw. ubuntu 9.10默认的便是UFW防火墙,它已经支持界面操作了.在 ...
- 【Linux】ubuntu或linux网卡配置/etc/network/interfaces
转自:http://gfrog.net/2008/01/config-file-in-debian-interfaces-1/ 青蛙准备写一个系列文章,介绍一些Debian/Ubuntu里面常用的 ...
随机推荐
- (转)Hdmi edid 数据解析
Hdmi edid 数据解析 (转自:http://blog.chinaunix.net/uid-20672559-id-3384035.html) 一.EDID数据格式: EDID 1.3 d ...
- 教你如何架设linux邮件服务器postfix
检查linux是否有安装postfix和dovecot 检查命令如下: Rpm -qa |grep postfix; Rpm –qa |grep dovecot; 如果没有显示任何数据,表明没有安 ...
- CSS导入使用及引用的两种方法
方法一<link rel="stylesheet" type="text/css" href="test.css"> 方法二&l ...
- js点击标签时获取当前标签属性值
document.body.onclick=function(){ var obj = document.elementFromPoint(event.clientX,event.clientY); ...
- c++ _int64 转成string
_i64toa(a,buffer,10); scanf("%I64d",&a);printf("%I64d",a); 就可以正确输入输出了.当使用uns ...
- 【Deep learning】NLP
http://www.tuicool.com/articles/EvaQJnJ http://cs224d.stanford.edu/syllabus.html
- myeclipse配置Hadoop插件
每个版本的 hadoop 都有相应版本的 MyEclipse 插件,官网并没有提供插件的jar包下载.在hadoop/src/contrib 目录下有一个 eclipse-plugin 项目,此项目就 ...
- Unity3D手机平台分辨率自动匹配教程
1. 下载NGUI 2. 导入NGUI package到Unity. 这时候菜单上会出现NGUI的菜单栏: 3. 将默认的Main Camera删掉,通过菜单栏NGUI->Create新建一个2 ...
- 关于BSTR数据类型
关于BSTR数据类型 - 极品垃圾 - C++博客 http://www.cppblog.com/bestcln/articles/82712.html VC++常用数据类型及其操作详解(非常经典,共 ...
- error MSB8031
http://go.microsoft.com/fwlink/p/?LinkId=286820 下载