One of the most frequently replied posts in the official Docker Forum: "Upgrading data in a data container"

Source: Internet
Author: User
: This article mainly introduces one of the most frequently replied posts in the official Docker Forum, "upgrading data in a data container". if you are interested in PHP tutorials, refer to it. One of the most frequently replied posts in the official Docker Forum: "Upgrading data in a data container"


Matlehmann
I have a container containing data, which has a volume (for example, persistent data in/var/data. The container contains persistent data to the software of another container.
For new versions of the software, you need to upgrade the stated permanent data (structure or layout change, etc ). The result is that I want another data container (in/var/data) with upgraded data in the same location and the old data container remains unchanged with its data.
In this way, I can use the old data container and the old version of the software in case of an error.
But how can I do this? The steps required to achieve the expected results are not obvious to me.
I can run a command to upgrade a container like docker run-I-t -- name temp -- volumes-from data-v/upgraded image/upgrade_script.sh
But how can I recover the upgraded data to the original location without overwriting the old data? If I run docker run-I-t -- volumes-from temp image cp/upgraded/var/data, it will overwrite my old data. Do I have to use the volume installed on the host to upgrade the data or have some better solutions?

Sam
I just guess, because here I generally prefer to use a direct host to install volumes and I am struggling to find the effectiveness of data containers.
But... can you submit your data container and save the image?
Sven
Oh, consider using the docker commit snapshot container SAM.
Keeb
I actually use data containers, such as UNIX pipelines; I think they are more natural in the paradigm
Docker run-name some_pipe_storage some_container_which_generates_data
Docker run -- volumes-from some_pipe_storage something_that_operates_on_data
Syntax. Very powerful but relatively primitive.

Sven
There are some interesting work about how docker, the management tool that joins the volume, is going-I think they are heading for 1.4 and I will do some research. (There will be a docker Volume list and something to manipulate)
I may create a backup_data volume container and then run a data migration image, I want to run the connection to data and backup_data-the first thing it may do is to copy the data from backup_data and then migrate the data it will perform.
Then you can run the old and new databases to connect to each of their respective databackend (and possibly attached read-only backups ?)
In this way, if the host you are using should be installed almost the same, either directly or in a data container style.

Matlehmann
Your suggestion is my first thought line, but it does not meet my expectation, because after this process, the migrated data and the original data will be based on different paths, I cannot see any way to change this situation, because non-host volumes cannot be reinstalled to different paths. The volume path from a data container is static-even if the volume container is inherited by "-- volumes-from.
This is because the volume of the host is different, because I can change the mount location in each docker running call.
I think these volume management tools are very necessary. For me, this data container docker idiom is more like a work ING.
Could you elaborate on "docker commit is a dead man", because I cannot see it, however. At least in the case. As far as I know, a docker is submitted to me, which contains a new image of the current state of a container. This will include all OS data that I am interested in except persistent data.

Sven
Oh, crud. You are right. the volume path is static currently. So you need a step.
1. you have an existing data container in/data
2. migrate to a temporary data container at/for Migration (if you have an original installation)
3./migrate data to the data container/data installed in the new upgrade (the second migration image does not need the original data capacity
@ Cpuguy83 may tell you

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.