Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
yagamil
V2EX  ›  Linux

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

  •  
  •   yagamil · Jul 17, 2022 · 2862 views
    This topic created in 1424 days ago, the information mentioned may be changed or developed.

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

    有什么办法绕过这个。

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

    有什么办法吗?

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

    所以也就是你 ssh 上去后无法使用 docker 功能。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5113 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 78ms · UTC 09:23 · PVG 17:23 · LAX 02:23 · JFK 05:23
    ♥ Do have faith in what you're doing.