Docker容器高级使用与资源管理
1. 容器读写权限与基础系统更新
1.1 读写权限容器测试
在使用容器时,我们可以创建普通容器和只读容器进行测试。
- 普通容器操作 :
$ # Start a regular container
$ docker run -it \
--rm \
ubuntu /bin/bash
root@79042a966943:/# # Write something to /bin
root@79042a966943:/# echo "just_a_test" > /bin/test
root@79042a966943:/# # Check if it's there
root@79042a966943:/# ls -la /bin | grep test
-rw-r--r-- 1 root root 12 Sep 27 17:43 test
root@79042a966943:/# exit
exit
- 只读容器操作 :
$ # Now try a read-only container
$ docker run -it \
--rm \
--tmpfs /run \
--tmpfs /tmp \
--tmpfs /var/tmp \
--read-only \
ubuntu /bin/bash
root@5b4574a46c0
超级会员免费看
订阅专栏 解锁全文
1万+

被折叠的 条评论
为什么被折叠?



