Sunday, November 15, 2020

How to Change Default Subnet IP Address in Docker

Description: Docker uses default 172.17.0.0/16 subnet for container Networking. If this subnet not available for docker in your environment. You need to change it default subnet. Here I have explained How to change default subnet.

Procedure:

  • First, verify the existing network by using below command 

# docker network inspect bridge


  • Make sure no container is running using docker ps command 

  • Stop docker service using below command 
# systemctl stop docker
  • Create or edit the file using below command 
# vi /etc/docker/daemon.json

Add Lines:

  {
  "default-address-pools":
  [
    {"base":"10.10.0.0/16","size":24}
  ]
}


# systemctl start docker
  • Now verify network using below command and verify by creating new docker container with the name "ServerTechnoLab-Apache"






No comments:

Post a Comment