(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里面常用的 ...
随机推荐
- MySQL(五)之DDL(数据定义语言)与六大约束
前言 前面在数据库的讲解中,其实很多东西都非常的细节,在以前的学习过程中我都是没有注意到的.可能在以后的工作中会碰到所以都是做了记录的. 接下来,我将分享的是MySQL的DDL用来对数据库及表进行操作 ...
- 有限状态机FSM详解及其实现
有限状态机,也称为FSM(Finite State Machine),其在任意时刻都处于有限状态集合中的某一状态.当其获得一个输入字符时,将从当前状态转换到另一个状态,或者仍然保持在当前状态.任何一个 ...
- NHibernate初学三之条件查询(Criteria Queries)与AspNetPager分页实例
NHibernate除了SQL与HQL两种查询操作外,还有一种就是条件查询Criteria,本文将从网上整理一些Criteria的理论及小实例,最后通过一个结合AspNetPager分页来加深理解,必 ...
- 更改VS2010的[默认开发语言]
1.菜单-->"工具"-->"导入导出设置".例如以下图: 2.选择"重置全部设置",例如以下图: 3.重置设置,例如以下图: ...
- HLS图像处理系列——肤色检測
本博文採用Xilinx HLS 2014.4工具.实现一个肤色检測的模块.当中,本文重点是构建HLS图像处理函数. 新建HLSproject的步骤,本博文不再详述. 本project新建之后,仅仅加入 ...
- mybatis由浅入深day01_5.3 Mapper动态代理方法
5.3 Mapper动态代理方法(程序员只需要写mapper接口(相当于dao接口)) 5.3.1 实现原理(mapper代理开发规范) 程序员还需要编写mapper.xml映射文件 程序员编写map ...
- LinkedBlockingQueue(lbq)阻塞队列
最近开发中,经常使用这个类LinkedBlockingQueue,它是BlockingQueue这个子类. 并发库中的BlockingQueue是一个比较好玩的类,顾名思义,就是阻塞队列.该类主要提供 ...
- 【RF库测试】关键字get time
*** Test Cases ***Timestamp ${time} GET TIME ${secs} GET TIME epoch ${year} GET TIME return year ${y ...
- linux--GCC简单用法
gcc是linux下最常用的一款c编译器,对应于CPP 有相应的g++工具,debug有gdb,只是还不会用. 个人感觉gcc确实是个好东西,完全可以直接在gedit下编程然后写个shell脚本用gc ...
- lua和C++交互的lua栈操作——以LuaTinker为例
一. -- C++类注册函数(LuaTinker) 的lua栈操作: -- lua栈内容(执行到pop语句) 栈地址 <--执行语句 space_name[name] = t1 -- (2b8) ...