Skip to main content

Docker Firewall Configuration

Source: https://dev.to/soerenmetje/how-to-secure-a-docker-host-using-firewalld-2joo

Preparation

Required parts:

Install firewalld and activate service:

# pacman -Syu firewalld
# systemctl enable --now firewalld.service

Disable any other firewall services.

Disable iptables for docker by adding or changing /etc/docker/daemon.json by adding the following config options:

{
  "iptables": false
}

After changing this config file, restart the Docker daemon to apply the previous change:

# systemctl restart docker.service

As a result of the previous steps, only allowed ports on firewalld are accessible from the outside. However containers are now unable to connect outbound to the internet.

FirewallD Configuration