How can you modify kernel parameters in Docker?

To modify the kernel parameters of Docker, you can follow these steps:

  1. Edit the /etc/docker/daemon.json file and create it if it doesn’t exist.
  2. Add the following content to the file to configure the kernel parameters that need to be modified:
{
  "default-address-pools":
  [
    {"base":"172.80.0.0/16","size":24}
  ],
  "iptables": false,
  "ipv6": true,
  "ip-masq": false,
  "bridge": "none"
}

This is just an example, you can modify the parameters according to your own needs.

  1. Save and close the file.
  2. Restart the Docker service:
sudo systemctl restart docker
  1. To confirm if the kernel parameters are effective, you can use the following command to view Docker’s kernel parameters.
sudo docker info

By following the above steps, you can successfully modify the kernel parameters of Docker.

bannerAds