Running Lastest Skopeo On RHEL 7

Zhimin Wen
4 min readJan 9, 2022
Image by Erich Westendarp from Pixabay

We live in a world full of constraints. This is particularly true when we deal with enterprise IT. Recently I had a project, where the following little problem blocked the progress.

We are allocated a Redhat Enterprise Linux 7.x system, where we have to mirror some container images from the internet for the consumption of the local usage. The tool provided by the commercial software performed well to download the images. But at the last step, it could not proceed to label the images because it relies on Skopeo to list the tags first. The list tags function of Skopeo is only available after V1.0, while in the RHEL os that we are working on, the Skopeo is only at 0.1.41. We could not update the version due to this version of Skopeo is the last version provided for RHEL 7 as indicated in this URL by Redhat,

… This is planned to be the final release of RHEL 7 with major new features in the container tools software stack. This means Podman will not be updated beyond 1.6.4, Buildah will not be updated beyond 1.11.6, and Skopeo will not be updated beyond 0.1.41.

We will not have RHEL 8 box immediately, so we are stuck.

Walks around the problem

Though we can not run the latest Skopeo, we can run the latest container version of Skopeo. There is a available.

We can intercept all the Skopeo command call, rerun it in the container format with Podman. The bash code for this idea is shown as below,

PARSED_OPTIONS=$(/root/skopeo/parser $* | grep Parsed= | cut -d '=' -f 2)
cmd="podman run --network host --add-host {{ .hostname}}:{{ .hostip}} $PARSED_OPTIONS -it skopeo $*"#echo $cmd >> /tmp/skopeo.log
eval $cmd

The $* represents all the arguments from the original Skope command, we pass it to the podman run command.

Before it the container version Skopeo really work, we use the host network so that the container Skopeo can access the host network just as the normal Skopeo running on the host. We also add the local hostname/IP pair to the /etc/hosts in the container, so that the Skopeo in the container is able to resolve the host’s…