Live container migration with minimal production system impact
Live container migration management is provided. A read and write logical sub container layer that includes a set of changed files within a container layer of a first container is utilized to continue processing inputs and outputs corresponding to a service provided by the first container to avoid interruption of the service during live migration. A read only logical sub container layer that includes a plurality of original files within the container layer of the first container is copied to another container layer of a second container running on a second computer for the live migration without building the second container using a container image during the live migration.
1 . A method comprising:
generating, by a first computer, a read and write logical sub container layer and a set of read only logical sub container layers within a read and write container layer of a first container that includes a plurality of read only image layers below the read and write container layer in response to identifying a current set of changed files within a plurality of original files included in the read and write container layer, the read and write logical sub container layer includes the current set of changed files and the set of read only logical sub container layers includes the plurality of original files of the read and write container layer and any changed files prior to the current set of changed files;
utilizing, by the first computer, the read and write logical sub container layer that includes the current set of changed files within the read and write container layer of the first container to continue processing inputs and outputs corresponding to a service provided by the first container to avoid interruption of the service during live migration, wherein the read and write sub container layer allows file changes during the live migration and is not copied; and
copying, by the first computer, the set of read only logical sub container layers that includes the plurality of original files and the any changed files prior to the current set of changed files to another container layer of a second container running on a second computer for the live migration, wherein the second computer pulls a container image corresponding to the first container from a container image registry and runs the second container on the second computer using the container image prior to the live migration, and wherein the container image only includes the plurality of read only image layers corresponding to the first container that are not included in the set of read only logical sub container layers copied to the another container layer of the second container running on the second computer.
2 . The method of claim 1 , further comprising:
receiving, by the first computer, an input to perform the live migration of the first container from the first computer to the second container located on the second computer in a container-based environment, wherein the first container provides the service corresponding to a production system.
3 . The method of claim 1 , further comprising:
receiving, by the first computer, a result of a health check of the second container running on the second computer;
determining, by the first computer, whether the result of the health check of the second container is pass; and
responsive to the first computer determining that the result of the health check of the second container is pass, identifying, by the first computer, the current set of changed files within the plurality of original files included in the read and write container layer of the first container using a difference folder directory corresponding to the first container.
4 . The method of claim 1 , further comprising:
utilizing, by the first computer, the plurality of original files in the read and write container layer of the first container as a first read only logical sub container layer within the read and write container layer and the any changed files prior to the current set of changed files as a second read only logical sub container layer within the read and write container layer in response to identifying the current set of changed files within the plurality of original files.
5 . The method of claim 1 , further comprising:
copying, by the first computer, the current set of changed files in the read and write container layer of the first container into the read and write logical sub container layer within the read and write container layer.
6 . The method of claim 1 , further comprising:
marking, by the first computer, a first read only logical sub container layer that includes the plurality of original files as the first read only logical sub container layer within the read and write container layer and a second read only logical sub container layer that includes the any changed files prior to the current set of changed files as the second read only logical sub container layer within the read and write container layer.
7 . The method of claim 1 , further comprising:
marking, by the first computer, the read and write logical sub container layer that includes the current set of changed files as the read and write logical sub container layer within the read and write container layer.
8 . A computer system comprising:
a processor set;
one or more computer-readable storage media; and
program instructions stored on the one or more computer-readable storage media to cause the processor set to perform operations comprising:
generating, by a first computer, a read and write logical sub container layer and a set of read only logical sub container layers within a read and write container layer of a first container that includes a plurality of read only image layers below the read and write container layer in response to identifying a current set of changed files within a plurality of original files included in the read and write container layer, the read and write logical sub container layer includes the current set of changed files and the set of read only logical sub container layers includes the plurality of original files of the read and write container layer and any changed files prior to the current set of changed files;
utilizing, by the first computer, the read and write logical sub container layer that includes the current set of changed files within the read and write container layer of the first container to continue processing inputs and outputs corresponding to a service provided by the first container to avoid interruption of the service during live migration, wherein the read and write sub container layer allows file changes during the live migration and is not copied; and
copying, by the first computer, the set of read only logical sub container layers that includes the plurality of original files and the any changed files prior to the current set of changed files container layer of a second container running on a second computer for the live migration, wherein the second computer pulls a container image corresponding to the first container from a container image registry and runs the second container on the second computer using the container image prior to the live migration, and wherein the container image only includes the plurality of read only image layers corresponding to the first container that are not included in the set of read only logical sub container layers copied to the another container layer of the second container running on the second computer.
9 . The computer system of claim 8 , wherein the operations further comprise:
receiving, by the first computer, an input to perform the live migration of the first container from the first computer to the second container located on the second computer in a container-based environment, wherein the first container provides the service corresponding to a production system.
10 . The computer system of claim 8 , wherein the operations further comprise:
receiving, by the first computer, a result of a health check of the second container running on the second computer;
determining, by the first computer, whether the result of the health check of the second container is pass; and
responsive to the first computer determining that the result of the health check of the second container is pass, identifying, by the first computer, the current set of changed files within the plurality of original files included in the read and write container layer of the first container using a difference folder directory corresponding to the first container.
11 . The computer system of claim 8 , wherein the operations further comprise:
utilizing, by the first computer, the plurality of original files in the read and write container layer of the first container as a first read only logical sub container layer within the read and write container layer and the any changed files prior to the current set of changed files as a second read only logical sub container layer within the read and write container layer in response to identifying the current set of changed files within the plurality of original files.
12 . The computer system of claim 8 , wherein the operations further comprise:
copying, by the first computer, the current set of changed files in the read and write container layer of the first container into the read and write logical sub container layer within the read and write container layer.
13 . The computer system of claim 8 , wherein the operations further comprise:
marking, by the first computer, a first read only logical sub container layer that includes the plurality of original files as the first read only logical sub container layer within the read and write container layer and a second read only logical sub container layer that includes the any changed files prior to the current set of changed files as the second read only logical sub container layer within the read and write container layer; and
marking, by the first computer, the read and write logical sub container layer that includes the current set of changed files as the read and write logical sub container layer within the read and write container layer.
14 . A computer program product comprising:
one or more computer-readable storage media; and
program instructions stored on the one or more computer-readable storage media to perform operations comprising:
generating, by a first computer, a read and write logical sub container layer and a set of read only logical sub container layers within a read and write container layer of a first container that includes a plurality of read only image layers below the read and write container layer in response to identifying a current set of changed files within a plurality of original files included in the read and write container layer, the read and write logical sub container layer includes the current set of changed files and the set of read only logical sub container layers includes the plurality of original files of the read and write container layer and any changed files prior to the current set of changed files;
utilizing, by the first computer, the read and write logical sub container layer that includes the current set of changed files within the read and write container layer of the first container to continue processing inputs and outputs corresponding to a service provided by the first container to avoid interruption of the service during live migration, wherein the read and write sub container layer allows file changes during the live migration and is not copied; and
copying, by the first computer, the set of read only logical sub container layers that includes the plurality of original files and the any changed files prior to the current set of changed files to another container layer of a second container running on a second computer for the live migration, wherein the second computer pulls a container image corresponding to the first container from a container image registry and runs the second container on the second computer using the container image prior to the live migration, and wherein the container image only includes the plurality of read only image layers corresponding to the first container that are not included in the set of read only logical sub container layers copied to the another container layer of the second container running on the second computer.
15 . The computer program product of claim 14 , wherein the operations further comprise:
receiving, by the first computer, an input to perform the live migration of the first container from the first computer to the second container located on the second computer in a container-based environment, wherein the first container provides the service corresponding to a production system.
16 . The computer program product of claim 14 , wherein the operations further comprise:
receiving, by the first computer, a result of a health check of the second container running on the second computer;
determining, by the first computer, whether the result of the health check of the second container is pass; and
responsive to the first computer determining that the result of the health check of the second container is pass, identifying, by the first computer, the current set of changed files within the plurality of original files included in the read and write container layer of the first container using a difference folder directory corresponding to the first container.
17 . The computer program product of claim 14 , wherein the operations further comprise:
utilizing, by the first computer, the plurality of original files in the read and write container layer of the first container as a first read only logical sub container layer within the read and write container layer and the any changed files prior to the current set of changed files as a second read only logical sub container layer within the read and write container layer in response to identifying the current set of changed files within the plurality of original files.
18 . The computer program product of claim 14 , wherein the operations further comprise:
copying, by the first computer, the current set of changed files in the read and write container layer of the first container into the read and write logical sub container layer within the read and write container layer.
19 . The computer program product of claim 14 , wherein the operations further comprise:
marking, by the first computer, a first read only logical sub container layer that includes the plurality of original files as the first read only logical sub container layer within the read and write container layer and a second read only logical sub container layer that includes the any changed files prior to the current set of changed files as the second read only logical sub container layer within the read and write container layer.
20 . The computer program product of claim 14 , wherein the operations further comprise:
marking, by the first computer, the read and write logical sub container layer that includes the current set of changed files as the read and write logical sub container layer within the read and write container layer.