使用教程
安装
# Ubuntu/Debian
sudo apt install skopeo
# Fedora/CentOS
sudo dnf install skopeo
# openSUSE
sudo zypper install skopeo
# Alpine
sudo apk add skopeo
# Gentoo
sudo emerge app-containers/skopeo
# Arch Linux
sudo pacman -S skopeo
# macOS
brew install skopeo
# Nix / NixOS
nix-env -i skopeo
编译安装
# 源码编译
git clone https://github.com/containers/skopeo $GOPATH/src/github.com/containers/skopeo
cd $GOPATH/src/github.com/containers/skopeo && make bin/skopeo
# 安装
sudo make install
用法
登录仓库(如果需要)
# 登录 Docker Hub(如果是私有镜像)
skopeo login docker.io
# 登录你的私有仓库
skopeo login myregistry.example.com
传输协议
传输协议 | 示例 | 说明 |
containers-storage: | containers-storage:alpine:latest | 访问本地容器存储,存储在本地文件系统中的镜像。 |
dir: | dir:/PATH | 将镜像存储为本地目录 |
docker:// | docker://k8s.gcr.io/kube-apiserver:v1.17.5 | 访问远程 Docker 注册表的镜像 |
docker-daemon: | docker-daemon:alpine:latest | 直接从本地 Docker 守护进程的存储中访问镜像 |
docker-archive: | docker-archive:alpine.tar (docker save) | 处理以 docker save 格式保存的镜像归档文件(通常为 tar 文件) |
oci: | oci:alpine:latest | 使用 OCI 格式的本地存储,镜像以标准化的目录结构存储 |
Skopeo 的命令通常遵循 skopeo [command] [transport:name] [options]
的结构。
复制整个 manifest list
(多架构支持)
从 Docker Hub
复制镜像到私有仓库
skopeo copy --all \
docker://docker.io/library/your-image:tag \
docker://myregistry.example.com/your-namespace/your-image:tag
删除镜像
skopeo delete docker://localhost:5000/imagename:latest
验证
可以使用以下命令检查推送后的多架构支持:
skopeo inspect --raw docker://myregistry.example.com/your-namespace/your-image:tag | jq .
更多帮助信息
skopeo --help
Various operations with container images and container image registries
Usage:
skopeo [flags]
skopeo [command]
Available Commands:
copy Copy an IMAGE-NAME from one location to another
delete Delete image IMAGE-NAME
generate-sigstore-key Generate a sigstore public/private key pair
help Help about any command
inspect Inspect image IMAGE-NAME
list-tags List tags in the transport/repository specified by the SOURCE-IMAGE
login Login to a container registry
logout Logout of a container registry
manifest-digest Compute a manifest digest of a file
standalone-sign Create a signature using local files
standalone-verify Verify a signature using local files
sync Synchronize one or more images from one location to another
Flags:
--command-timeout duration timeout for the command execution
--debug enable debug output
-h, --help help for skopeo
--insecure-policy run the tool without any policy check
--override-arch ARCH use ARCH instead of the architecture of the machine for choosing images
--override-os OS use OS instead of the running OS for choosing images
--override-variant VARIANT use VARIANT instead of the running architecture variant for choosing images
--policy string Path to a trust policy file
--registries.d DIR use registry configuration files in DIR (e.g. for container signature storage)
--tmpdir string directory used to store temporary files
-v, --version Version for Skopeo
Use "skopeo [command] --help" for more information about a command.