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
- 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
- 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
- Run the following commands to stop NetworkManager and start networking.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.