![](/img/trans.png)
[英]Mount Docker container in Azure App Service as read-only filesystem
[英]Mount Docker container's root filesystem as read only
我想在運行以下命令時將容器的根文件系統掛載為只讀:
docker ps --quiet --all | \
xargs docker inspect \
--format '{{ .Id }}: ReadonlyRootfs={{ .HostConfig.ReadonlyRootfs }}'
如果上述命令返回true
,則表示根文件系統以只讀方式掛載。 如果上述命令返回false
,則表示根文件系統是可寫的。
當我運行命令時,顯示ReadonlyRootfs=false
。 我如何讓它顯示true
?
當您將標志--read-only
傳遞給docker run
命令時,根文件系統以只讀方式掛載,例如:
$ docker run -it --read-only centos
[root@87e0f56dc341 /]# touch test
touch: cannot touch 'test': Read-only file system
幫助頁面:
$ docker run --help | grep read-only
--read-only
Mount the container's root filesystem as read only
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.