Technical work, should be praised and then see, form a habitCopy the code

Docker use tutorial related series of directories


Problem: The mysql container cannot be deleted or connected if stopped. Docker stop,docker kill and other commands are invalid.

Treatment methods:

1. Stop all containers

docker stop $(docker ps -q)
Copy the code

2. Remove the container forcibly

docker rm -f mysql1
Copy the code

3. Clear the network usage of the container

Format: Docker network disconnect –force Network mode container name

docker network disconnect --force bridge mysql1
Copy the code

4. Check if any containers with the same name are still occupied

Format: Docker network inspect Network mode

Example: Docker Network Inspect BridgeCopy the code

5. Rebuild the container

docker run --name mysql1 -d -p3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:latest
Copy the code

This is also true for other types of containers.