Docker custom bridge docker0 and docker's opening, closing, and restarting command operations

Docker custom bridge docker0 and docker's opening, closing, and restarting command operations

question

After the company migrated the server, the docker0 bridge created by default conflicted with the company's external network gateway.

This results in the external network being unable to connect to the server.

Solution

Modify the default configuration file /etc/docker/daemon.json to configure Docker.

If not created directly

1. Shut down the docker service

systemctl stop docker

2. Modify bip

{
 "bip": "192.168.0.1/24", # Modify here.... 
}

3. Restart Docker

systemctl restart docker

Docker shutdown, restart, and start commands

sudo service docker stop # Shut down or sudo systemctl stop docker
sudo service docker restart # Restart or sudo systemctl restart docker
sudo service docker start # Start sudo systemctl start docker # Start

Supplement: Modify the default ip of docker0

When the Docker service is started, a docker0 bridge is created by default (with a docker0 internal interface on it), which connects other physical or virtual network cards at the kernel layer, putting all containers and the local host on the same physical network.

By default, Docker specifies the IP address and subnet mask of the docker0 interface, allowing the host and container to communicate with each other through the bridge. It also gives the MTU (the maximum transmission unit allowed to be received by the interface), which is usually 1500 Bytes, or the default value supported by the host network routing. These values ​​can be configured when the service is started.

You can edit the /etc/docker/daemon.json file and add the content "bip": "ip/netmask" [Do not use the same network segment as the host]

[root@localhost /]# vi /etc/docker/daemon.json
{"bip":"192.168.100.1/24"}

The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. If there are any mistakes or incomplete considerations, please feel free to correct me.

You may also be interested in:
  • Docker Compose network settings explained
  • A brief discussion on docker-compose network settings
  • Docker adds a bridge and sets the IP address range
  • A troubleshooting experience of centos Docker bridge mode unable to access the host Redis service
  • Docker-compose creates a bridge, adds a subnet, and deletes a network card

<<:  Use a diagram to explain what Web2.0 is

>>:  Detailed explanation of the properties and instance usage of hasOwnProperty in js

Recommend

Implementing a simple calculator with javascript

This article example shares the specific code of ...

How to solve the mysql error 1033 Incorrect information in file: 'xxx.frm'

Problem Description 1. Database of the collection...

MySQL 8.0.11 installation and configuration method graphic tutorial

The installation and configuration methods of MyS...

Implementation of MySQL5.7 mysqldump backup and recovery

MySQL backup Cold backup:停止服務進行備份,即停止數據庫的寫入Hot ba...

Detailed examples of the difference between methods watch and computed in Vue.js

Table of contents Preface introduce 1. Mechanism ...

Summary of common Linux distribution mirror source configuration

I have been researching Linux recently and tried ...

How does Zabbix monitor and obtain network device data through ssh?

Scenario simulation: The operation and maintenanc...

Tutorial on how to modify the root password in MySQL 5.7

Version update, the password field in the origina...

25 advanced uses of JS array reduce that you must know

Preface Reduce is one of the new conventional arr...

Two methods to disable form controls in HTML: readonly and disabled

In the process of making web pages, we often use f...

Vue data responsiveness summary

Before talking about data responsiveness, we need...