What should the server do if the file cannot be uploaded because of Exit when docker uses storage?
This article mainly shows you what to do when docker uses storage Exit to cause files not to be uploaded to the server. The content is simple and easy to understand. I hope you can learn. After learning, there will be gains. Let's take a look at it.
1. Problem description
The storage installed in the docker container has been in an exit state, resulting in files that cannot be stored.
2. Solution
View containers installed in docker
Docker ps-a
Try to start the container
Docker start storage (or docker start "container ID")
If the container is still exiting after trying to start the container, delete the container
Docker container rm storage (or docker container rm "container ID")
Go to the / var/fdfs folder and delete the storage file
Cd / var/fdfssodo rm-r storage
Reinstall the storage container
Sudo docker run-dti-- network=host-- name storage-e TRACKER_SERVER=10.0.2.15 (intranet ip): 22122-v / var/fdfs/storage:/var/fdfs delron/fastdfs storage
Check to see if the container started successfully
3. Test whether the container can be used normally.
Note: to test in the django module of python, you need to install the fdfs_client module
Pip3 install fdfs_client
Enter the shell environment of django
Python manage.py shell
Write in a shell environment
From fdfs_client.client import Fdfs_client# client.conf is the configuration file fdfs = Fdfs_client ('utils/fastdfs/client.conf') # upload the file fdfs.upload_by_filename (' media/2018.png') by file name
Get the return response
Test whether the path is successful
Http://127.0.0.1:8888/group1/M00/00/00/CgACD17bAsqACuoXAAfh_rrm7jw614.png
This is what happens when docker uses storage and Exit causes files not to be uploaded to the server. If you have learned knowledge or skills, you can share it for more people to see.