# docker-firewall
[![Build Status](https://travis-ci.org/nikkoura/docker-firewall.svg?branch=master)](https://travis-ci.org/nikkoura/docker-firewall)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
This is a simple container that adds iptables rules to the host in a custom chain, in order to open some ports to the public and/or allow any connection from given IPs. This is useful for example with RancherOS, where just about everything runs as a container. When the container is stopped, the chain is removed.
## Usage
```
docker run --name firewall \
 --env OPEN_PORTS="22,80,443" \
 --env OPEN_PORTS_UDP="60000:60010" \
 --env ACCEPT_ALL_FROM="ip1,ip2" \
 --env CHAIN="DOCKER-FIREWALL" \
 -itd \
 --restart=always \
 --cap-add=NET_ADMIN \
 --net=host \
 nikkoura/docker-firewall:1 \
```
Either or both ˋOPEN_PORTSˋ / ˋOPEN_PORTS_UDPˋ has to be specified. 
# Image registry
This container image is available on the Docker hub: https://hub.docker.com/r/nikkoura/firewall
# Credits
This fork is based on https://github.com/vitobotta/docker-firewall. Thanks!