为容器挂载主机目录
# scr 主机目录
# dst 容器中的目录
ctr container create docker.io/library/busybox:latest busybox-test --mount type=bind,src=/home/workspace/busybox-mount-test,dst=/home,options=rbind:rw
运行容器
ctr tasks start -d busybox-test bash
向挂载目录中添加文件
touch /home/workspace/busybox-mount-test/test.txt
进入容器查看
ctr tasks exec --exec-id $RANDOM -t busybox-test bash
评论 (0)