如何将Docker中的/ proc文件系统重新挂载为R / W系统? [英] How to remount the /proc filesystem in a docker as a r/w system?
问题描述
我已经在Ubuntu 12.04上安装了docker 0.11.1。
我试图在运行命令时从docker内部将shmmax从其固定值(32 M)更改为更大(1G)
:
I have installed docker 0.11.1 over Ubuntu 12.04. I am trying to change the shmmax from its fixed value (32 M) to something bigger (1G) from within the docker when I run the command:
sysctl -w kernel.shmmax=1073741824
error: "Read-only file system" setting key "kernel.shmmax"
这是因为安装了 / proc
ro
在容器中。
That is because /proc
is mounted ro
in the container.
有人可以告诉我如何将proc安装为 r / w
在我的容器中进行更改?
Can someone tell me how to mount the proc as r/w
in my container to change it?
推荐答案
如果目标是设置sysctl设置,则docker已经意识到了这个问题,并且在1.12+您可以在运行Docker容器时(或在您的撰写文件中)使用--sysctl标志,这将在容器运行之前设置容器中的值。
If the goal is to set sysctl settings, docker has realized the issue and in 1.12+ you can use the --sysctl flag when running a docker container (or in your compose file) which will set the values inside the container before it is run.
这是遗憾的是,尚未(尚未)集成到dockerfile语法中。
This is sadly not (yet) integrated yet in the dockerfile syntax.
docker run --sysctl kernel.shmmax=1073741824 yourimage
示例docker-compo se.yml(必须使用2.1版):
Example docker-compose.yml (must use version 2.1):
version: '2.1'
services:
app:
sysctls:
- kernel.shmmax=1073741824
这篇关于如何将Docker中的/ proc文件系统重新挂载为R / W系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!