The following instructions show how to prepare a TGZ file containing Docker images and files to help loading docker images to a private Docker registry.
The instructions have 3 major steps:
- On a non-air-gapped system, create a TGZ file.
- Transfer the TGZ file from the non-air-gapped system to the air-gapped system.
- On the air-gapped system, use the TGZ file to populate an local Docker repository and (optionally) populate a private Docker registry.
The goal of these steps is to produce a compressed file in tgz
format
(docker-images.tgz
)
containing Docker images that can be installed on an air-gapped system
and files to help wth populating the private Docker registry from that system.
The following steps are performed on an internet-connected system. They will not work on an air-gapped system.
The following steps create a docker-images.tar
file containing docker images.
-
✏️ Identify a new directory for outputting files. Example:
export SENZING_DOCKER_DIR=~/my-senzing-docker
-
Make directories for output. Example:
mkdir -p ${SENZING_DOCKER_DIR}
-
Get versions of Docker images. Example:
curl -X GET \ --output ${SENZING_DOCKER_DIR}/docker-versions-stable.sh \ https://raw.githubusercontent.com/Senzing/knowledge-base/main/lists/docker-versions-stable.sh chmod +x ${SENZING_DOCKER_DIR}/docker-versions-stable.sh source ${SENZING_DOCKER_DIR}/docker-versions-stable.sh
-
✏️ List Docker images to be packaged. Add or delete Docker images from the list. For extensive list, see docker-image-names.sh Example:
export DOCKER_IMAGE_NAMES=( "senzing/senzingapi-runtime:${SENZING_DOCKER_IMAGE_VERSION_SENZINGAPI_RUNTIME:-latest}" )
-
Pull Docker images to local, non-air-gapped workstation. Example:
for DOCKER_IMAGE_NAME in ${DOCKER_IMAGE_NAMES[@]}; do docker pull ${DOCKER_IMAGE_NAME} done
-
Save Docker images as a
.tar
file. Example:docker save ${DOCKER_IMAGE_NAMES[@]} --output ${SENZING_DOCKER_DIR}/docker-images.tar
-
Create
docker-tag-and-push.sh
that will be used to push images to private Docker registry from air-gapped system. Example:echo '#!/usr/bin/env bash' > ${SENZING_DOCKER_DIR}/docker-tag-and-push.sh for DOCKER_IMAGE_NAME in ${DOCKER_IMAGE_NAMES[@]}; do echo "" >> ${SENZING_DOCKER_DIR}/docker-tag-and-push.sh echo "docker tag ${DOCKER_IMAGE_NAME} \${DOCKER_REGISTRY_URL}/${DOCKER_IMAGE_NAME}" >> ${SENZING_DOCKER_DIR}/docker-tag-and-push.sh echo "docker push \${DOCKER_REGISTRY_URL}/${DOCKER_IMAGE_NAME}" >> ${SENZING_DOCKER_DIR}/docker-tag-and-push.sh echo "docker rmi \${DOCKER_REGISTRY_URL}/${DOCKER_IMAGE_NAME}" >> ${SENZING_DOCKER_DIR}/docker-tag-and-push.sh done chmod +x ${SENZING_DOCKER_DIR}/docker-tag-and-push.sh
-
Compress
.tar
file to make it a smaller.tgz
file. Example:tar \ --create \ --directory=${SENZING_DOCKER_DIR} \ --file=${SENZING_DOCKER_DIR}/docker-images.tgz \ --gzip \ --verbose \ docker-tag-and-push.sh docker-versions-stable.sh docker-images.tar
- Transfer
${SENZING_DOCKER_DIR}/docker-images.tgz
to the air-gapped system.
The following instructions show how to load docker images into local Docker repository and populate a private registry in an air-gapped environment.
-
✏️ Specify the location of the
docker-images.tgz
file. Example:export SENZING_DOCKER_IMAGES_TGZ=~/docker-images.tgz
-
✏️ Specify the output location for uncompressing the file. Example:
export SENZING_OUTPUT_DIR=~/my-senzing-output
-
Uncompress file. Example:
mkdir --parents ${SENZING_OUTPUT_DIR} tar \ --directory=${SENZING_OUTPUT_DIR} \ --extract \ --file=${SENZING_DOCKER_IMAGES_TGZ} \ --gzip \ --verbose
This step will add the Docker images to the Docker repository on the local workstation.
The contents of the local Docker repository are seen via the docker images
command.
-
Load Docker images onto local workstation. Example:
docker load --input ${SENZING_OUTPUT_DIR}/docker-images.tar
🤔 Optional: This step is only needed if the Docker images need to be added to a private Docker registry. If working on a single workstation, this step is not necessary.
-
✏️ Identify the URL of the private Docker registry. Example:
export DOCKER_REGISTRY_URL=my.docker-registry.com:5000
-
✏️ Run
docker-tag-and-push.sh
Example:${SENZING_OUTPUT_DIR}/docker-tag-and-push.sh