Load a Docker file created with docker save, mimic Docker load. The file is a tarball containing several layers, each layer has metadata and data content (directory tree) stored as a tar file.
(self, tmp_imagedir, imagerepo=None)
| 835 | return loaded_repositories |
| 836 | |
| 837 | def load(self, tmp_imagedir, imagerepo=None): |
| 838 | """Load a Docker file created with docker save, mimic Docker |
| 839 | load. The file is a tarball containing several layers, each |
| 840 | layer has metadata and data content (directory tree) stored |
| 841 | as a tar file. |
| 842 | """ |
| 843 | self._imagerepo = imagerepo |
| 844 | structure = self._load_structure(tmp_imagedir) |
| 845 | if not structure: |
| 846 | Msg().err("Error: failed to load image structure") |
| 847 | return [] |
| 848 | if "repositories" in structure and structure["repositories"]: |
| 849 | repositories = self._load_repositories(structure) |
| 850 | else: |
| 851 | if not imagerepo: |
| 852 | imagerepo = Unique().imagename() |
| 853 | tag = Unique().imagetag() |
| 854 | repositories = self._load_image(structure, imagerepo, tag) |
| 855 | return repositories |
| 856 | |
| 857 | def _save_image(self, imagerepo, tag, structure, tmp_imagedir): |
| 858 | """Prepare structure with metadata for the image""" |