containerd 使用 namespace 隔离容器运行时
1. ctr namespace help
root@suaxi:~# ctr namespace -h
NAME:
ctr namespaces - Manage namespaces
USAGE:
ctr namespaces command [command options] [arguments...]
COMMANDS:
create, c Create a new namespace
list, ls List namespaces
remove, rm Remove one or more namespaces
label Set and clear labels for a namespace
OPTIONS:
--help, -h show help
2. 查看 namespace
ctr namespace ls
NAME LABELS
moby
k8s.io
3. 创建
ctr namespace create test
# 再次查看
ctr namespace ls
NAME LABELS
moby
k8s.io
test
4. 删除
ctr namespace rm test
# 再次查看
ctr namespace ls
NAME LABELS
moby
k8s.io
5. 补充
(1)查看指定 namespace 运行的用户进程
ctr -n test tasks ls
(2)在指定 namespace 中拉取镜像
ctr -n test images pull docker.io/library/nginx:latest
(3)在指定 namespace 中创建静态容器
ctr -n test container create docker.io/library/nginx:latest nginx-test
(4)查看在指定 namespace 中创建的容器
ctr -n test container ls
CONTAINER IMAGE RUNTIME
nginx-test docker.io/library/nginx:latest io.containerd.runc.v2
评论 (0)