One, the problem exists between the creation of a Docker container exit or the deletion of container data that cannot be saved and the smaller partition in the Docker container, which can be used to refer to the following several methods.
1, mount the host directory to the container.
Docker run-d-v/data/:/data1/centos/bin/bash
Here the-V means that the directory where the/data/directory is a host is mounted, and the directory is created first mkdir/data/
Directory of/DATA1 for containers
There are limitations to this approach, and if I do load balancing and have more than one, then I need each container to be mounted like this.
2. Mount the container volume
The existence of this method avoids the repeated operations we have described above.
Docker RUN-ITD--volumes-from (name of container) Centos/bin/bash
The name of the container here can be the container where we have previously mounted the/data directory, and the container that mounts the container will have the/data directory mounted.
3, create a container volume (this third method is similar to NFS, which requires 1 containers to share a directory and then to mount the container volume when the other container starts)
This kind of backup recovery is relatively troublesome (for the time being, this method is not considered).
Docker Data Management