[Updated1]我有一个shell会在某些函数中更改TCP内核参数,但现在我需要让这个shell在Docker容器中运行,这意味着shell需要知道它在容器内运行并停止配置内核.
现在我不知道如何实现,这里是/proc/self/cgroup
容器内部的内容:
9:hugetlb:/ 8:perf_event:/ 7:blkio:/ 6:freezer:/ 5:devices:/ 4:memory:/ 3:cpuacct:/ 2:cpu:/docker/25ef774c390558ad8c4e9a8590b6a1956231aae404d6a7aba4dde320ff569b8b 1:cpuset:/
我可以使用上面的任何标志来确定此进程是否在容器内运行?
[Updated2]:我还注意到确定进程是否在lxc/Docker中运行,但在这种情况下似乎不起作用/proc/1/cgroup
,我的容器中的内容是:
8:perf_event:/ 7:blkio:/ 6:freezer:/ 5:devices:/ 4:memory:/ 3:cpuacct:/ 2:cpu:/docker/25ef774c390558ad8c4e9a8590b6a1956231aae404d6a7aba4dde320ff569b8b 1:cpuset:/
没有/ lxc/containerid