数据持久化

suaxi
2025-07-02 / 0 评论 / 2 阅读 / 正在检测是否收录...

为容器挂载主机目录

# 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

评论 (0)

取消