V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
yagamil
V2EX  ›  Linux

docker 在没有特权模式下,里面的安装的服务无法启动(systemctl 无法启动)

  •  
  •   yagamil · 2022-07-17 17:44:53 +08:00 · 1919 次点击
    这是一个创建于 641 天前的主题,其中的信息可能已经有所发展或是发生改变。

    docker 容器里面的应用没有给特权, 使用 systemctl 会报错 报错是 :Failed to get D-Bus connection: Operation not permitted

    有什么办法绕过这个。

    情景: 有一台云主机,提供的镜像是 基于 docker 的 centos ,ssh 进去后,打算在里面安装一个 docker ,安装上了,可是启动的时候需要 systemctl start docker , 无法启动。

    有什么办法吗?

    10 条回复    2022-07-18 19:35:01 +08:00
    ly841000
        1
    ly841000  
       2022-07-17 18:09:15 +08:00
    试试 Podman ?
    yagamil
        2
    yagamil  
    OP
       2022-07-17 18:26:38 +08:00
    应该问题一样,
    报错:
    ERRO[0000] 'overlay' is not supported over overlayfs
    Error: error creating libpod runtime: 'overlay' is not supported over overlayfs: backing file system is unsupported for this graph driver
    ch2
        3
    ch2  
       2022-07-17 19:47:17 +08:00 via iPhone   ❤️ 1
    Docker in Docker 的条件非常苛刻,必须以 privileged 模式启动。文件系统不能是 overlayfs ,也就是说只能内层的 Docker 只能在外层 Docker 通过-v 挂载的 ext4 上进行自己的 overlayfs 挂载。还要挂载上 /lib/modules ,反正这些条件你都达不到就别想啦
    SpringHack
        4
    SpringHack  
       2022-07-17 23:00:23 +08:00 via iPhone
    user mode linux 试试呢
    yagamil
        5
    yagamil  
    OP
       2022-07-18 00:21:35 +08:00
    @ch2 好的~ 谢老哥
    THESDZ
        6
    THESDZ  
       2022-07-18 09:11:53 +08:00
    换个思路,不要 docker in docker 而是 挂载外部 docker 的通讯,例如 docker.sock 等。
    zliea
        7
    zliea  
       2022-07-18 10:11:42 +08:00
    docker in docker ,其实只是 docker cli in docker ,实际还是需要依赖宿主机的 docker 服务。
    (其实正如同 vm in vm 不行,不支持嵌套虚拟化)
    所以楼上说的就是把宿主机的 docker.sock 挂载到 docker client 的容器里(需要特权),然后只是 cli 操作而已。
    julyclyde
        8
    julyclyde  
       2022-07-18 11:07:50 +08:00
    1 不要在容器里运行完整操作系统
    2 systemd 需要的 capbilities 在文档里列出来了
    killva4624
        9
    killva4624  
       2022-07-18 11:54:23 +08:00
    使用 Docker in Docker 的场景是什么? 说不定有另外的解决办法,不一定要 docker daemon
    yagamil
        10
    yagamil  
    OP
       2022-07-18 19:35:01 +08:00
    云场家给的应用是 ubuntu centos wordpress 这种 docker 镜像,
    选择完整镜像 ubuntu 后,实际就是在 docker 里面运行。

    所以也就是你 ssh 上去后无法使用 docker 功能。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1095 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 22:55 · PVG 06:55 · LAX 15:55 · JFK 18:55
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.