c12s-kubespray/contrib/offline
Kenichi Omichi 247d062c02
[2.16] Fix how to get image ID on offline deployment (#7829)
* Add error handling for registorying images (#7787)

When running the script, I faced the following error but it was
difficult to know the root problem due to lack of error handling.

  docker tag" requires exactly 2 arguments.
  See 'docker tag --help'.

  Usage:  docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]

  Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE

To investigate such errors easily, this adds an error handling.

* Fix how to get image ID on offline deployment (#7808)

Previously IDs of container images were gotten from tar files of container
images but that way was wrong. If multiple json files are contained in a
tar file, the script got multiple IDs and tried to pass these IDs on
`docker tag` command. Then the command was failed.

This updates the script to get image IDs from `docker image inspect` command
to fix this issue.
In addition, this adds a check a registry container exists already or not
before deploying registry container to avoid a container conflict failure.
2021-07-28 00:01:35 -07:00
..
docker-daemon.json Add manage-offline-container-images.sh (#7024) 2021-01-06 08:05:52 -08:00
generate_list.sh Add script for generate download files and images list (#7561) 2021-05-11 00:39:36 -07:00
manage-offline-container-images.sh [2.16] Fix how to get image ID on offline deployment (#7829) 2021-07-28 00:01:35 -07:00
README.md Add script for generate download files and images list (#7561) 2021-05-11 00:39:36 -07:00
registries.conf Add manage-offline-container-images.sh (#7024) 2021-01-06 08:05:52 -08:00

Offline deployment

manage-offline-container-images.sh

Container image collecting script for offline deployment

This script has two features: (1) Get container images from an environment which is deployed online. (2) Deploy local container registry and register the container images to the registry.

Step(1) should be done online site as a preparation, then we bring the gotten images to the target offline environment. Then we will run step(2) for registering the images to local registry.

Step(1) can be operated with:

manage-offline-container-images.sh   create

Step(2) can be operated with:

manage-offline-container-images.sh   register

generate_list.sh

This script generates the list of downloaded files and the list of container images by roles/download/defaults/main.yml file.

Run this script will generates three files, all downloaded files url in files.list, all container images in images.list, all component version in generate.sh.

bash generate_list.sh
tree temp
temp
├── files.list
├── generate.sh
└── images.list
0 directories, 3 files

In some cases you may want to update some component version, you can edit generate.sh file, then run bash generate.sh | grep 'https' > files.list to update file.list or run bash generate.sh | grep -v 'https'> images.list to update images.list.