Help Center/ Elastic Cloud Server/ Troubleshooting/ Configuring the Network/ How Do I Fix Too High Memory Usage by NetworkManager When Multiple Docker Containers Are Running?
Updated on 2023-03-30 GMT+08:00

How Do I Fix Too High Memory Usage by NetworkManager When Multiple Docker Containers Are Running?

Symptom

NetworkManager consumes a large amount of memory when multiple Docker containers are running.

  • The operations described in this section apply to ECSs running CentOS 7 or Ubuntu 16.04.
  • The operations described in this section involve restarting the network service, which may interrupt services.

Possible Causes

The amount of memory consumed by NetworkManager increases with each container start or stop, it never decreases, even after all containers have been stopped and removed.

Solution

Short-term solution

Restart NetworkManager.

# systemctl restart NetworkManager

Long-term solution

  • CentOS 7

    Run the following commands to stop NetworkManager and start network.

    # systemctl disable NetworkManager

    # /sbin/chkconfig network on

    # kill `pgrep -o dhclient`

    # systemctl stop NetworkManager

    # systemctl start network

    If network startup fails, it may be caused by the built-in configuration files of multiple NICs. For details about how to rectify the fault, see How Do I Fix a Network Startup Failure Due to Multiple NIC Configuration Files?

  • Ubuntu 16.04
    1. Run the following commands to stop NetworkManager and start networking.

      # systemctl disable NetworkManager

      # systemctl disable network-manager

      # systemctl enable networking

      # kill `pgrep -o dhclient`

      # systemctl stop NetworkManager

      # systemctl start networking

    2. To enable networking, check whether DHCP is configured for NICs in the interfaces file.

      vi /etc/network/interfaces

      If only eth0 is attached, you can check whether the following information exists in interfaces. If not, add it to the file.

      auto eth0
      iface eth0 inet dhcp
      Figure 1 Configuring the NIC to use DHCP