Docker Data Management

Source: Internet
Author: User
Tags docker run

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.