How to disable Docker’s iptables on Systemd Linux systems

Objective

In some cases, it is necessary to disable Docker’s IPtables rules to avoid overwriting any existing firewall rules. The following article describes a simple to follow procedure on how to disable disable Docker’s IPtables rules on Systemd Linux systems.

Requirements

Privileged access to your Systemd Linux is required.

Difficulty

EASY

Conventions

  • # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
  • $ – requires given linux commands to be executed as a regular non-privileged user

Instructions

Create new Systemd Service

First, create a new directory:

# mkdir /etc/systemd/system/docker.service.d

Create a new service configuration file iptables-disabled.conf inside the previously created directory /etc/systemd/system/docker.service.d/ with a following content:

[Service]
ExecStart=
ExecStart=/usr/bin/docker daemon -H fd:// --iptables=false

Reload Systemd Daemon

# systemctl daemon-reload

Restart Services

At this stage restart your firewall and docker. Alternatively, reboot your system.



Comments and Discussions
Linux Forum