Files
reg/help/image_pull.go
2026-11-05 06:40:24 +03:00

99 lines
4.3 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package help
import (
"fmt"
"reg/internal/i18n"
)
var msgPull = &i18n.Msg{
EN: `pull — download an image from a registry.
Usage:
reg [-r <registry>] pull <image>[:<tag>|@<digest>] [-o <dir>] [-f [<name>]] [-platform <os/arch>] [-v]
Description:
Downloads the manifest, config and all layers of an image. By default,
saves as an OCI image layout directory; with -f — as a tar archive
with the same content.
Flags:
-o <dir> parent directory for saving.
Without -f, creates a subdirectory <repo>-<tag>;
with -f — an image file. The directory is created
automatically if it does not exist. Default is the
current directory.
-f [<name>] save the image as .tar (not a directory).
Without value — <repo>-<tag>.tar.
With value — exactly the given name (no path; path is
set via -o). Supported forms: -f, -f name, -f=name.
-platform <p> platform (os/arch[/variant]); default — current.
-v print progress to stderr (one JSON line per event:
start, manifest, platform_selected, blob_start,
blob_done, done).
Notes:
- For multi-arch images the requested platform is selected (see -platform).
- Each blob is verified by sha256 after download.
- Repeated runs are idempotent: existing blobs with the expected size
are not re-downloaded.
- The resulting directory (or tar) can be used with reg push.
Examples:
reg pull myapp:1.5
reg pull myapp:1.5 -v
reg pull myapp:1.5 -o /var/lib/images
reg pull myapp:1.5 -o /var/lib/images -platform linux/arm64
reg pull myapp:1.5 -f
reg pull myapp:1.5 -f myapp-1.5.tar
reg pull myapp:1.5 -f=myapp-1.5.tar -o /var/lib/images
reg -r registry.tld pull myapp:1.5
`,
RU: `pull — скачать образ из реестра.
Использование:
reg [-r <registry>] pull <image>[:<tag>|@<digest>] [-o <dir>] [-f [<name>]] [-platform <os/arch>] [-v]
Описание:
Скачивает манифест, config и все слои образа. По умолчанию
сохраняет в формате OCI image layout-каталога; с флагом -f —
в tar-архив с тем же содержимым.
Флаги:
-o <dir> родительский каталог для сохранения.
Без -f внутри него создаётся подкаталог <repo>-<tag>;
с -f — файл образа. Каталог создаётся автоматически,
если его нет. По умолчанию — текущий каталог.
-f [<name>] сохранить образ как .tar (а не каталог).
Без значения — <repo>-<tag>.tar.
Со значением — ровно указанное имя (без пути; путь
задаётся через -o). Поддерживаются формы -f, -f name,
-f=name.
-platform <p> платформа (os/arch[/variant]); по умолчанию — текущая.
-v выводить прогресс в stderr (по одной JSON-строке на
событие: start, manifest, platform_selected,
blob_start, blob_done, done).
Нюансы:
- Для multi-arch образов выбирается нужная платформа (см. -platform).
- Каждый blob проверяется по sha256 после скачивания.
- Повторные запуски идемпотентны: существующие blob'ы с ожидаемым
размером не перекачиваются.
- Полученный каталог (или tar) можно использовать для reg push.
Примеры:
reg pull myapp:1.5
reg pull myapp:1.5 -v
reg pull myapp:1.5 -o /var/lib/images
reg pull myapp:1.5 -o /var/lib/images -platform linux/arm64
reg pull myapp:1.5 -f
reg pull myapp:1.5 -f myapp-1.5.tar
reg pull myapp:1.5 -f=myapp-1.5.tar -o /var/lib/images
reg -r registry.tld pull myapp:1.5
`,
}
func printPull() {
fmt.Print(msgPull.String())
}