# US 2023/0266955 A1 · Container image management

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2023/0266955 A1
- Document ID: US20230266955A1
- Status: Published application
- Kind: A1
- Application number: 17/652,159
- Filed: 2022-02-23
- Published: 2023-08-24
- Earliest claimed: 2022-02-23
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Lu Yan Li; Zhan Peng Huo; Fei Tan; Jiu Chang Du
- Web page: https://patentgrep.com/patent/US20230266955A1

## CPC

- G06F 8/63: {Image based installation; Cloning; Build to order}
- G06F 9/45558: {Hypervisor-specific management and integration aspects}
- G06F 2009/45562: {Creating, deleting, cloning virtual machine instances}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Methods, systems, and computer program products for container image management are disclosed. In a method, a first group of operations that are performed in respective layers in a base image are obtained. A second group of operations that are performed in respective layers not comprised in the base image are obtained. The second group of operations are optimized based on a comparison between the first and second groups of operations. A destination container image is generated based on the optimized second group of operations and the base image.

## Claims

### Claim 1

A method comprising:
obtaining, by one or more processors, a first group of operations that are performed in respective layers comprised in a base image;
obtaining, by one or more processors, a second group of operations that are performed in respective layers not comprised in the base image;
optimizing, by one or more processors, the second group of operations based on a comparison between the first and second groups of operations; and
generating, by one or more processors, a destination container image based on the optimized second group of operations and the base image.

### Claim 2 (depends on 1)

The method of claim 1, wherein the optimizing the second group of operations based on the comparison comprises:
comparing, by one or more processors, the operation with the first group of operations; and
in response to the operation being repeated with one of the first group of operations, deleting, by one or more processors, the operation from the second group of operations.

### Claim 3 (depends on 2)

The method of claim 2, wherein the comparing the operation with the first group of operations comprises:
classifying, by one or more processors, the operation into a first type or a second type, the first type representing an operation changing the destination container image, and the second type representing an operation not changing the destination container image; and
implementing, by one or more processors, at least one from a group consisting of:
in response to the operation being classified as the first type, comparing, by one or more processors, the operation with the first group of operations; and
in response to the operation being classified as the second type, deleting, by one or more processors, the operation.

### Claim 4 (depends on 3)

The method of claim 3, wherein the comparing the operation with the first group of operations comprises:
determining, by one or more processors, a layer object digest for a layer object that is operated by the operation;
comparing, by one or more processors, the layer object digest for the layer object that is operated by the operation with each of layer object digests for a group of layer objects that are operated by the first group of operations, respectively; and
in response to the layer object digest for the layer object that is operated by the operation being identical to any of the group of layer object digests for the group of layer objects that are operated by the first group of operations, determining, by one or more processors, that the operation is repeated with one of the first group of operations.

### Claim 5 (depends on 4)

The method of claim 4, wherein the determining the layer object digest for the layer object that is operated by the operation comprises:
in response to the layer object that is operated by the operation being an application to be installed by the operation, determining, by one or more processors, the layer object digest based on a version of the application; or
in response to the layer object that is operated by the operation being a node to be managed by the operation in a file system related to the destination container image, determining, by one or more processors, the layer object digest based on a digest of the node.

### Claim 6 (depends on 3)

The method of claim 3, wherein the obtaining the first group of operations comprises:
receiving, by one or more processors, the first group of operations from a container builder file from which the destination container image is generated; and
wherein the obtaining the second group of operations comprises: extracting, by one or more processors, the second group of operations from the container builder file.

### Claim 7 (depends on 6)

The method of claim 6, further comprising:
classifying, by one or more processors, the operation of the first type into a third type or a fourth type, the third type representing an operation that produces the same result whenever the operation is performed, and the fourth type representing an operation that does not always produce the same result when the operation is performed at different time points; and
implementing, by one or more processors, at least one from a group consisting of:
in response to the operation being classified as the third type, collecting, by one or more processors, the operation; and
in response to the operation being classified as the fourth type, comparing the operation with the first group of operations.

### Claim 8 (depends on 3)

The method of claim 3, wherein the obtaining the first group of operations comprises: receiving, by one or more processors, the first group of operations from a running container; and wherein the obtaining the second group of operations comprises: obtaining, by one or more processors, the second group of operations from a group of commands that are inputted in the running container.

### Claim 9 (depends on 1)

The method of claim 1, wherein the optimizing the second group of operations based on the comparison comprises:
determining, by one or more processors, a plurality of operations in the second group of operations that have an association relationship based on the comparison;
combining, by one or more processors, the plurality of operations into a new operation; and
replacing, by one or more processors, the plurality of operations in the second group of operations with the new operation.

### Claim 10 (depends on 1)

The method of claim 1, further comprising: receiving a source container image from which the destination container image is generated, wherein the obtaining the first group of operations comprises: obtaining the first group of operations from a base image of the source container image; and wherein the obtaining the second group of operations comprises:
obtaining the second group of operations in the source container image.

### Claim 11

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, the program instructions comprising:
program instructions to obtain a first group of operations that are performed in respective layers comprised in a base image;
program instructions to obtain a second group of operations that are performed in respective layers not comprised in the base image;
program instructions to optimize the second group of operations based on a comparison between the first and second groups of operations; and
program instructions to generate a destination container image based on the optimized second group of operations and the base image.

### Claim 12 (depends on 11)

The computer program product of claim 11, wherein program instructions to optimize the second group of operations based on the comparison comprises:
program instructions to compare the operation with the first group of operations; and
program instructions, in response to the operation being repeated with one of the first group of operations, to delete the operation from the second group of operations.

### Claim 13 (depends on 12)

The computer program product of claim 12, wherein the program instructions to compare the operation with the first group of operations comprises:
program instructions to classify the operation into a first type or a second type, the first type representing an operation changing the destination container image, and the second type representing an operation not changing the destination container image; and
implementing at least one from a group consisting of:
program instructions, in response to the operation being classified as the first type, to compare the operation with the first group of operations; and
program instructions, in response to the operation being classified as the second type, to delete the operation.

### Claim 14 (depends on 11)

The computer program product of claim 11, wherein the program instructions to optimize the second group of operations based on the comparison comprises:
program instructions to determine a plurality of operations in the second group of operations that have an association relationship based on the comparison;
program instructions to combine the plurality of operations into a new operation; and
program instructions to replace the plurality of operations in the second group of operations with the new operation.

### Claim 15

A computer system comprising:
one or more computer processors;
one or more computer readable storage media; and
program instructions stored on the computer readable storage media for execution by at least one of the one or more processors, the program instructions comprising:
program instructions to obtain a first group of operations that are performed in respective layers comprised in a base image;
program instructions to obtain a second group of operations that are performed in respective layers not comprised in the base image;
program instructions to optimize the second group of operations based on a comparison between the first and second groups of operations; and
program instructions to generate a destination container image based on the optimized second group of operations and the base image.

### Claim 16 (depends on 15)

The computer system of claim 15, wherein program instructions to optimize the second group of operations based on the comparison comprises:
program instructions to compare the operation with the first group of operations; and
program instructions, in response to the operation being repeated with one of the first group of operations, to delete the operation from the second group of operations.

### Claim 17 (depends on 16)

The computer system of claim 16, wherein the program instructions to compare the operation with the first group of operations comprises:
program instructions to classify the operation into a first type or a second type, the first type representing an operation changing the destination container image, and the second type representing an operation not changing the destination container image; and
implementing at least one from a group consisting of:
program instructions, in response to the operation being classified as the first type, to compare the operation with the first group of operations; and
program instructions, in response to the operation being classified as the second type, to delete the operation.

### Claim 18 (depends on 15)

The computer system of claim 15, wherein the program instructions to optimize the second group of operations based on the comparison comprises:
program instructions to determine a plurality of operations in the second group of operations that have an association relationship based on the comparison;
program instructions to combine the plurality of operations into a new operation; and
program instructions to replace the plurality of operations in the second group of operations with the new operation.

### Claim 19 (depends on 16)

The computer system of claim 16, wherein the obtaining the first group of operations comprises:
program instructions to receive the first group of operations from a container builder file from which the destination container image is generated; and
wherein the obtaining the second group of operations comprises: program instructions to extract the second group of operations from the container builder file.

### Claim 20 (depends on 16)

The computer system of claim 16, wherein the program instructions to obtain the first group of operations comprises:
program instructions to receive the obtaining the first group of operations from a running container; and
wherein the obtaining the second group of operations comprises: program instructions to obtain the second group of operations from a group of commands that are inputted in the running container.
