Solution to Docker's failure to release ports

Solution to Docker's failure to release ports

Today I encountered a very strange situation. After updating the docker image, I ran docker-compose up -d and the message Bind for 0.0.0.0:xxxx failed: port is already allocated appeared. After netstat -ap | grep xxxx, I found that a docker process had been occupying this port and the service could not be restarted.

Through a series of solutions:

For example, killing the process and restarting Docker did not succeed. I will then share a method that I hope will provide a solution to students who encounter the same problem.

sudo cp /var/lib/docker/network/files/local-kv.db /var/lib/docker/network/files/local-kv.db_bk
sudo rm /var/lib/docker/network/files/local-kv.db
sudo docker-compose up -d

Supplement: Solution to the docker port being occupied "port is already allocated"

The Docker launcher displays "port is already allocated". I tried the following methods:

1. By restarting Docker

2. Restart your computer

3. Check the program corresponding to the occupied port and kill it

4. stop and rm all docker programs

None of them work.

Solution

The problem can be solved by finding the docker-compose.yml file in the corresponding working directory and changing the occupied port to another port.

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 file storage path, modify port mapping operation mode
  • How to add docker port and get dockerfile
  • Docker primary network port mapping configuration
  • How to modify the port mapping of a running Docker container
  • How to dynamically modify container port mapping in Docker
  • Docker port mapping and external inaccessibility issues
  • Docker image access to local elasticsearch port operation

<<:  A detailed analysis and processing of MySQL alarms

>>:  HTML 5 Reset Stylesheet

Recommend

Explore JavaScript prototype data sharing and method sharing implementation

Data Sharing What kind of data needs to be writte...

Detailed tutorial on uploading and configuring jdk and tomcat on linux

Preparation 1. Start the virtual machine 2. git t...

Detailed explanation of the error problem of case when statement

Preface In the MySQL database, sometimes we use j...

Nginx rewrite regular matching rewriting method example

Nginx's rewrite function supports regular mat...

JavaScript event delegation principle

Table of contents 1. What is event delegation? 2....

In-depth understanding of Vue's method of generating QR codes using vue-qr

Table of contents npm download step (1) Import (2...

Steps to encapsulate the carousel component in vue3.0

Table of contents 1: Encapsulation idea 2. Packag...

Handtrack.js library for real-time monitoring of hand movements (recommended)

【Introduction】: Handtrack.js is a prototype libra...

A brief introduction to the general process of web front-end web development

I see many novice students doing front-end develop...

A brief analysis of the configuration items of the Angular CLI release path

Preface Project release always requires packaging...

Summary of the differences between count(*), count(1) and count(col) in MySQL

Preface The count function is used to count the r...

Linux common commands chmod to modify file permissions 777 and 754

The following command is often used: chmod 777 文件...