跳轉到

Daemon settings

Custom Settings of Docker

Changed data root for images and containers to save my poor disk, where /var/lib/docker is located.

Also, changed default address allocation settings 1 2 so that a simple one-container compose project will not eat /16 again. Saved my CIDR blocks for other use.

$ cat /etc/docker/daemon.json
{
  "data-root": "/path/to/custom/docker/path",
  "default-address-pools":[
    {"base":"172.20.0.0/16","size":24},
    {"base":"172.21.0.0/16","size":24}
  ] 
}

  1. https://blog.joelbuckley.com.au/2022/12/til-docker-default-address-pools 

  2. https://medium.com/@jacob.swanson.n/making-docker-use-different-ip-ranges-on-ubuntu-27ba6cbb825d