V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
wuwenzhx
V2EX  ›  问与答

请教下大佬们, Docker 如何在不停掉镜像的前提下修改当前已启动镜像的权限

  •  
  •   wuwenzhx · Dec 27, 2018 · 3607 views
    This topic created in 2685 days ago, the information mentioned may be changed or developed.
    问题是这样的:
    启动了一个镜像,想在镜像里面使用 perf 火焰图诊断下性能瓶颈,但是遇到了没有权限的问题:
    由于镜像 /proc/sys/kernel/perf_event_paranoid 是只读的,perf 不能收集系统状态
    #sudo perf record -F 99 -p 7070 -g -- sleep 30
    perf_event_open(..., PERF_FLAG_FD_CLOEXEC) failed with unexpected error 1 (Operation not permitted)
    perf_event_open(..., 0) failed unexpectedly with error 1 (Operation not permitted)
    Error:
    You may not have permission to collect stats.
    Consider tweaking /proc/sys/kernel/perf_event_paranoid:
    -1 - Not paranoid at all
    0 - Disallow raw tracepoint access for unpriv
    1 - Disallow cpu events for unpriv
    2 - Disallow kernel profiling for unpriv

    我 google 了一下需要加上--privileged 重启镜像才有权限,问题是我不知道镜像的启动命令.请教下 V2 的各位大佬们如何在不停掉镜像的情况下修改已启动镜像的目录权限?
    4 replies    2018-12-27 23:05:05 +08:00
    tomczhen
        1
    tomczhen  
       Dec 27, 2018 via Android
    正常思维模式不应该是“如何查询已经运行的容器的启动参数”吗?
    wuwenzhx
        2
    wuwenzhx  
    OP
       Dec 27, 2018
    @tomczhen docker inspect 看了有点头疼,分析不出来命令 启动命令有点复杂
    mritd
        3
    mritd  
       Dec 27, 2018
    这个方式不知道能否委婉的解决问题 https://serverfault.com/questions/861227/restart-docker-container-in-privileged-mode 希望对楼主有帮助
    wuwenzhx
        4
    wuwenzhx  
    OP
       Dec 27, 2018
    @mritd 谢谢,我试下修改 hostconfig.json
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2899 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 09:15 · PVG 17:15 · LAX 02:15 · JFK 05:15
    ♥ Do have faith in what you're doing.