Cross-platform application containerized execution
A manifest file from a container image for a cross-platform application that has been containerized for execution on a source platform specifies image layers for the cross-platform application within the container image and are ordered from a first image layer through a last image layer. The manifest file specifies exclusion/inclusion directories related to containerized execution of the cross-platform application on a target platform different than the source platform. Starting with the first image layer and ending at the last image layer, each image layer is unpacked at the target platform by copying files from the image layer to a directory at the target platform in accordance with the identified exclusion/inclusion directories. A version of the cross-platform application corresponding to the image layers as unpacked at the target platform is executed in a containerized manner.
1 . A non-transitory computer-readable data storage medium storing program code executable by a processor to perform processing comprising:
reading a manifest file from a container image for a cross-platform application associated with a first operating system that has been containerized for execution on a source platform;
identifying, within the manifest file, specification of a plurality of image layers for the cross-platform application within the container image, the image layers ordered from a first image layer through a last image layer;
identifying, within the manifest file, specification of a plurality of exclusion/inclusion directories related to containerized execution of the cross-platform application on a target platform different than the source platform;
starting with the first image layer and ending at the last image layer, unpacking each image layer at the target platform by copying files from each image layer to a directory at the target platform in accordance with the identified specification of the plurality of exclusion/inclusion directories;
executing a version of the cross-platform application associated with a second operating system corresponding to the image layers as unpacked at the target platform, in a containerized manner,
wherein the first operating system is different than the second operating system;
identifying, within the manifest file, a link from a source directory path on the source platform to a target directory path on the target platform;
creating a directory structure on the target platform corresponding to the target directory path; and
as the version of the cross-platform application is executed, translating a file system isolation-oriented command specific to the source platform and referring to the source directory path to a symbolic link to the created directory structure on the target platform corresponding to the target directory path as specified by the link,
wherein translation of the file system isolation-oriented command to the symbolic link maintains file system isolation during containerized execution of the cross-platform application on the target platform and
wherein the file system isolation-oriented command specific to the source platform and referring to the source directory comprises a change root command unavailable at the target platform, the change root command changing a root directory to the source directory on the source platform and wherein execution of the target platform is performed without native execution of the change root command.
2 . The non-transitory computer-readable data storage medium of claim 1 , wherein starting with the first image layer and ending at the last image layer, unpacking each image layer at the target platform comprises:
creating the directory at the target platform for the version of the cross-platform application corresponding to the plurality of image layers.
3 . The non-transitory computer-readable data storage medium of claim 2 , wherein the processing further comprises:
creating the symbolic link to the directory at the target platform corresponding to the version of the cross-platform application,
and wherein the version of the cross-platform application corresponding to the images layer as unpacked at the target platform is executed in the containerized manner by initiating containerized execution at the symbolic link.
4 . The non-transitory computer-readable data storage medium of claim 1 , wherein the plurality of exclusion/inclusion directories comprise inclusion directories, and copying the files from each image layer to the directory at the target platform in accordance with the identified specification of the plurality of exclusion/inclusion directories comprises:
copying just the files from each image layer to the directory at the target platform that are within the inclusion directories.
5 . The non-transitory computer-readable data storage medium of claim 1 , wherein the plurality of exclusion/inclusion directories comprise exclusion directories, and copying the files from each image layer to the directory at the target platform in accordance with the identified specification of the plurality of exclusion/inclusion directories comprises:
copying the files from each image layer to the directory at the target platform except files that are within the exclusion directories.
6 . The non-transitory computer-readable data storage medium of claim 1 , wherein the processing further comprises:
identifying, within the manifest file, a reference checksum for each image layer specific to the target platform; and
as each image layer is unpacked at the target platform, computing a checksum of the files copied from each image layer to the target platform and comparing the checksum to the reference checksum.
7 . The non-transitory computer-readable data storage medium of claim 6 , wherein the processing further comprises creating a new version of the cross-platform application by:
creating a new directory at the target platform corresponding to the new version of the cross-platform application;
copying files from the directory to the new directory;
after the new directory has been user-modified, computing a checksum of new and modified files within the new directory;
adding the computed checksum of the new and modified files within the new directory to a manifest file for the new version within the container image; and
packing the new and modified files within the new directory into a new image layer for the new version within the container image.
8 . The non-transitory computer-readable data storage medium of claim 1 , wherein the file system isolation-oriented command specific to the source platform and referring to the source directory further comprises a mount point command unavailable at the target platform and creating a mount point at the source directory.
9 . The non-transitory computer-readable data storage medium of claim 8 , wherein execution on the target platform is performed without creating a native mount point.
10 . A method, comprising:
receiving, by a processor, specification of a plurality of exclusion/inclusion directories related to containerized execution of a cross-platform application associated with a first operating system on a target platform;
adding, by the processor, the plurality of exclusion/inclusion directories to a manifest file of a container image for the cross-platform application that has been containerized for execution on a source platform different than the target platform;
identifying within the manifest file, by the processor, specification of a plurality of image layers for the cross-platform application within the container image, the image layers ordered from a first image layer through a last image layer;
starting with the first image layer and ending at the last image layer, unpacking, by the processor, each image layer at the target platform by extracting files from each image layer in accordance with the plurality of exclusion/inclusion directories;
as each image layer is unpacked at the target platform, computing, by the processor, a checksum of the files copied from the image layer to the target platform and adding the computed checksum for the image layer to the manifest file;
saving, by the processor, the container image including the manifest file to which the plurality of exclusion/inclusion directories and the computed checksum for each image layer has been added;
creating, by the processor, a new version of the cross-platform application associated with a second operating system for execution on the target platform,
wherein the first operating system is different than the second operating system,
receiving, by the processor, specification of a link from a source directory path on the source platform to a target path on the target platform in correspondence with which a directory structure is created on the target platform; and
adding, by the processor, the link to the manifest file,
wherein the link pertains to a file system isolation-oriented command specific to the source platform that is unavailable at the target platform and that is translated to a symbolic link to the created directory structure on the target platform to maintain file system isolation during containerized execution of the cross-platform application on the target platform and
wherein the file system isolation-oriented command specific to the source platform and referring to the source directory comprises a change root command unavailable at the target platform, the change root command changing a root directory to the source directory on the source platform and wherein execution of the target platform is performed without native execution of the change root command.
11 . The method of claim 10 , wherein the plurality of exclusion/inclusion directories comprise inclusion directories, and extracting the files from the image layer in accordance with the plurality of exclusion/inclusion directories comprises:
extracting just the files from the image layer that are within the plurality of inclusion directories.
12 . The method of claim 10 , wherein the plurality of exclusion/inclusion directories comprise exclusion directories, and extracting the files from the image layer in accordance with the plurality of exclusion/inclusion directories comprises:
extracting the files from the image layer except the files that are within the exclusion directories.
13 . The method of claim 10 , wherein creating a new version of the cross-platform application further includes:
creating a new directory at the target platform corresponding to the new version of the cross-platform application;
copying the files from a directory corresponding to an existing version of the cross-platform application to the new directory;
after the new directory has been user-modified, computing a checksum of new and modified files within the new directory;
adding the computed checksum of the new and modified files within the new directory to a manifest file for the new version within the container image; and
packing the new and modified files within the new directory into a new image layer for the new version within the container image.
14 . The method of claim 10 , wherein the file system isolation-oriented command specific to the source platform and referring to the source directory further comprises a mount point command unavailable at the target platform and creating a mount point at the source directory.
15 . The method of claim 14 , wherein execution on the target platform is performed without creating a native mount point.
16 . A computing device running a target platform, comprising:
a storage device storing a container image for a cross-platform application that has been containerized for execution on a source platform different than the target platform;
a processor;
a non-transitory computer-readable data storage medium storing program code that the processor executes to:
identify, within a manifest file of the container image, specification of a plurality of image layers for the cross-platform application associated with a first operating system within the container image, the image layers ordered from a first image layer through a last image layer;
identify, within the manifest file, specification of a plurality of exclusion/inclusion directories related to containerized execution of the cross-platform application on a target platform different than the source platform;
starting with the first image layer and ending at the last image layer, unpack each image layer at the target platform by copying files from each image layer to a directory at the target platform in accordance with the identified specification of the plurality of exclusion/inclusion directories;
execute a version of the cross-platform application associated with a second operating system corresponding to the image layers as unpacked at the target platform, in a containerized manner,
wherein the first operating system is different than the second operating system;
identify, within the manifest file, a link from a source directory path on the source platform to a target directory path on the target platform;
create a directory structure on the target platform corresponding to the target directory path; and
as the version of the cross-platform application is executed, translate a file system isolation-oriented command specific to the source platform that is unavailable at the target platform and which refers to the source directory path to a symbolic link to the created directory structure on the target platform corresponding to the target directory path as specified by the link,
wherein translation of the file system isolation-oriented command to the symbolic link maintains file system isolation during containerized execution of the cross-platform application on the target platform and
wherein the file system isolation-oriented command specific to the source platform and referring to the source directory comprises a change root command unavailable at the target platform, the change root command changing a root directory to the source directory on the source platform and wherein execution of the target platform is performed without native execution of the change root command.
17 . The computing device of claim 16 , wherein the processor executes the program code to further:
identify, within the manifest file, a reference checksum for each image layer specific to the target platform; and
as each image layer is unpacked at the target platform, compute a checksum of the files copied from each image layer to the target platform and comparing the checksum to the reference checksum.
18 . The computing device of claim 16 , wherein the plurality of exclusion/inclusion directories comprise inclusion directories, and the processor copies the files from each image layer to the directory at the target platform in accordance with the identified specification of the plurality of exclusion/inclusion directories by:
copying just the files from the image layer to the directory at the target platform that are within the inclusion directories.
19 . The computing device of claim 16 , wherein the plurality of exclusion/inclusion directories comprise exclusion directories, and the processor copies the files from each image layer to the directory at the target platform in accordance with the identified specification of the plurality of exclusion/inclusion directories by:
copying the files from the image layer to the directory at the target platform except files that are within the exclusion directories.
20 . The computing device of claim 16 , wherein the file system isolation-oriented command specific to the source platform and referring to the source directory further comprises a mount point command unavailable at the target platform and creating a mount point at the source directory.