Kubernetes/Containerd/Docs/Nerdctl工具.md
offends 7a2f41e7d6
All checks were successful
continuous-integration/drone Build is passing
synchronization
2024-08-07 18:54:39 +08:00

65 lines
1.0 KiB
Markdown
Raw 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.

> 本文作者:丁辉
# Nerdctl工具
[Github](https://github.com/containerd/nerdctl)
## 开始安装
1. 下载软件
```bash
wget https://github.com/containerd/nerdctl/releases/download/v1.7.6/nerdctl-1.7.6-linux-amd64.tar.gz
```
2. 解压文件
```bash
tar -zxvf nerdctl-*-linux-amd64.tar.gz
```
3. 安装
```bash
install -o root -g root -m 0755 nerdctl /usr/local/bin/nerdctl
```
## 基本使用
- 查看 Containerd 镜像
```bash
nerdctl -n k8s.io images
```
- 登录镜像仓库
```bash
nerdctl -n k8s.io login <仓库地址> -u <账号> -p<密码>
```
- 退出镜像仓库登录
```bash
nerdctl -n k8s.io logout <仓库地址>
```
- 拉取镜像
```bash
nerdctl -n k8s.io pull nginx:latest
```
- 更改镜像 TAG
```bash
nerdctl -n k8s.io tag nginx:v1 nginx:v2
```
- 推送镜像
```bash
nerdctl -n k8s.io push nginx:latest --insecure-registry
```
> `--insecure-registry` 表示目标仓库是一个不安全的私有仓库不需要进行TLS证书验证