Last active
June 21, 2022 10:01
-
-
Save deskoh/74828dd3d12d1643ff36a5d2dddf4af6 to your computer and use it in GitHub Desktop.
Skopeo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
if "%2" == "" ( | |
echo Download image from Docker registry into OCI format in "images" directory. | |
echo. | |
echo Usage: | |
echo %0 ^<image-name^> ^<private-image-tag^> | |
echo. | |
echo Example usage: | |
echo %0 nginx:alpine internal-registry:5000/nginx:alpine | |
exit /b 1 | |
) | |
REM Create default signature policy in `<root>/etc/containers/policy.json` | |
REM See: https://github.com/containers/skopeo/blob/main/default-policy.json | |
set IMAGE=%~1 | |
set PRIVATE_IMAGE=%~2 | |
REM replace [:./] with [_] | |
set BAT_FILENAME=%IMAGE::=-% | |
set BAT_FILENAME=%BAT_FILENAME:.=-% | |
set BAT_FILENAME=%BAT_FILENAME:/=-% | |
echo Exporting %IMAGE% to %CD%\images (reference: %PRIVATE_IMAGE%) | |
skopeo copy --override-os=linux --remove-signatures docker://%~1 oci:%CD%\images:%~2 | |
set LOAD_SCRIPT=_load_%BAT_FILENAME%.bat | |
echo Generating %LOAD_SCRIPT% | |
echo skopeo copy oci:%%CD%%\images:%~2 docker://%PRIVATE_IMAGE% > %LOAD_SCRIPT% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
if "%2" == "" ( | |
echo Download image from Docker registry into "docker save" format. | |
echo. | |
echo Usage: | |
echo %0 ^<image-name^> ^<private-image-tag^> | |
echo. | |
echo Example usage: | |
echo %0 nginx:alpine internal-registry:5000/nginx:alpine | |
exit /b 1 | |
) | |
REM Create default signature policy in `<root>/etc/containers/policy.json` | |
REM See: https://github.com/containers/skopeo/blob/main/default-policy.json | |
set IMAGE=%~1 | |
set PRIVATE_IMAGE=%~2 | |
REM replace [:./] with [_] | |
set TAR_FILENAME=%IMAGE::=-% | |
set TAR_FILENAME=%TAR_FILENAME:.=-% | |
set TAR_FILENAME=%TAR_FILENAME:/=-%.tar | |
echo Exporting %IMAGE% to %TAR_FILENAME% (reference: %PRIVATE_IMAGE%) | |
skopeo copy --override-os=linux docker://%~1 docker-archive:%TAR_FILENAME%:%~2 | |
set LOAD_SCRIPT=_load_%TAR_FILENAME%.bat | |
echo Generating %LOAD_SCRIPT% | |
echo skopeo copy docker-archive:%TAR_FILENAME% docker://%PRIVATE_IMAGE% > %LOAD_SCRIPT% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment