diff options
author | ralph isenmann | 2022-01-28 12:31:35 +0100 |
---|---|---|
committer | ralph isenmann | 2022-02-28 08:10:33 +0100 |
commit | 74cf179864c789b1fe8e00a52839194fff0c69df (patch) | |
tree | c1e7621dff63c7a076cd5a7f2195cfccbde31c58 /core | |
parent | [remote-access] insmod doesn't check modprobe.d (diff) | |
download | mltk-74cf179864c789b1fe8e00a52839194fff0c69df.tar.gz mltk-74cf179864c789b1fe8e00a52839194fff0c69df.tar.xz mltk-74cf179864c789b1fe8e00a52839194fff0c69df.zip |
[run-virt-docker] fix docker load for archives without repotag
Diffstat (limited to 'core')
-rwxr-xr-x | core/modules/run-virt-docker/data/opt/openslx/vmchooser/plugins/docker/docker-init | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/core/modules/run-virt-docker/data/opt/openslx/vmchooser/plugins/docker/docker-init b/core/modules/run-virt-docker/data/opt/openslx/vmchooser/plugins/docker/docker-init index c903e5a6..f98e6688 100755 --- a/core/modules/run-virt-docker/data/opt/openslx/vmchooser/plugins/docker/docker-init +++ b/core/modules/run-virt-docker/data/opt/openslx/vmchooser/plugins/docker/docker-init @@ -22,9 +22,12 @@ load_image () { pv -cN "Image Transfer" < $VM_DISKFILE_RO | docker load -q > $TMP_FILE echo "+ $(cat $TMP_FILE)" - local REPO_TAG=$(head -n 1 $TMP_FILE | cut -d" " -f3) - # rename image - docker tag "$REPO_TAG" "$CONTAINER_IMAGE_NAME" + # repotags in docker-archive optional, so the load output can be + # "Loaded image ID: sha256:<DIGES>" OR "Loaded image: <RepoTag>" + local repotag=$(head -n 1 $TMP_FILE | awk -F ': ' '{print $2}') + # rename image and remove old tag + writelog "docker tag $repotag $CONTAINER_IMAGE_NAME" + docker tag "$repotag" "$CONTAINER_IMAGE_NAME" rm -f -- "$TMP_FILE" elif [[ "$CONTAINER_IMAGE_CONTEXT" == "DOCKERFILE" || "$CONTAINER_IMAGE_CONTEXT" == "GIT_REPO" ]]; then @@ -56,11 +59,13 @@ function load_container_image() pv -cN "Image Transfer" < $DATA_CONTAINER_DNBD3_IMAGE | docker load -q > $TMP_FILE retval=$? echo "+ $(cat $TMP_FILE)" - local REPO_TAG=$(head -n 1 $TMP_FILE | cut -d" " -f3) + + # repotags in docker-archive optional, so the load output can be + # "Loaded image ID: sha256:<DIGES>" OR "Loaded image: <RepoTag>" + local repotag=$(head -n 1 $TMP_FILE | awk -F ': ' '{print $2}') # rename image and remove old tag - writelog "docker tag $REPO_TAG $CONTAINER_IMAGE_TAG" - docker tag "$REPO_TAG" "$CONTAINER_IMAGE_TAG" - docker rmi "$REPO_TAG" > /dev/null + writelog "docker tag $repotag $CONTAINER_IMAGE_TAG" + docker tag "$repotag" "$CONTAINER_IMAGE_TAG" rm -f -- "$TMP_FILE" return $retval } |