The project test environment database data is lost, so I would like to record it. It was installed using Docker at the time, thinking it would be used temporarily for a period of time and not be persistent. Suddenly the day before yesterday, the docker log was full, and my colleague wanted to clean up the log and used the following command: docker system prune As a result, the MySQL container was normally in a stopped state at the time, but it was killed all of a sudden. The data we backed up was from March, which was terrible. Then various studies began to resume. Then I went to the official documentation to study what this command does.
Now I feel relieved. Fortunately, the data volume has not been deleted. We can use the data volume to recover the data. Next, I will record my recovery plan. 1. Find the data volume location The data volume directory is under This 2. Recovery Use
Then create the container docker run -d -p 3309:3306 -v mysqldata:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 --name huifu mysql:5.7 Before recovering data, you need to delete the associated content in the newly created data volume, and then copy the previous data volume content to the current data volume for data recovery. cd /var/lib/docker/volumes/mysqldata/_data/ rm -f * rm -f -R * Copy content to data volume cd /var/lib/docker/volumes/1db16a9dfdf3442b117ebc2ec11df5df4db717cfd567c77fa0a49905a9652fa0/_data/ cp -R * /var/lib/docker/volumes/mysqldata/_data/ At this point, the database data recovery is complete. Enter the restored container to view Referenceshttps://docs.docker.com/engine/reference/commandline/system_prune/ https://www.cnblogs.com/cheyunhua/p/13433400.html This is the end of this article on how to recover docker container data. For more information about docker container data recovery, please search 123WORDPRESS.COM’s previous articles or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: A method of making carousel images with CSS3
>>: Design Theory: Textual Expression and Usability
Without further ado, here are the renderings. The...
Preface There are 4 types of operators in MySQL, ...
Preface Linux groups are organizational units use...
This article introduces Nginx from compilation an...
This article shares the installation and configur...
This article example shares the specific code of ...
Table of contents 1. What is a transaction? 2. Th...
Table of contents 1. Install and import 2. Define...
Chatbots can save a lot of manual work and can be...
Table of contents 1. Build Docker 2. Enter the co...
Table of contents Problem Description Scenario In...
The concept of lock ①. Lock, in real life, is a t...
In the previous article, we wrote about how to de...
<br /> Focusing on the three aspects of text...
Grayscale release refers to a release method that...