Start a service in docker container failed,with error: Failed to get D-Bus connection: No connection to service manager

前端 未结 2 867
面向向阳花
面向向阳花 2021-02-04 12:27

I installed docker image and built a image successfully.

When I ssh to the container and run the command service xxx start, an error popped:

2条回答
  •  北荒
    北荒 (楼主)
    2021-02-04 12:46

    This is known issue with systemd-based OSes inside Docker containers.

    Short answer: as well as replacing fakesystemd with systemd you need to attach /sys/fs/cgroup as a read-only volume into the container, build the image and then run it in "privileged" mode.

    This is the best guide I've found for this. It uses Centos as the example, but should work with any systemd-based OS.

提交回复
热议问题