Skip to content

D-Bus connection error when running systemctl inside container? #207

Open

Description

@gargworld

When I run systemctl command inside the container, I get D-Bus connection error
root@3924d7bb5e59 /]# systemctl status httpd
Failed to get D-Bus connection: Operation not permitted

can someone help or suggest what am I doing wrong.

Activity

  1. tolland commented on Dec 16, 2020

    @tolland

    Probably need to start the container privileged

  2. Pythonov commented on May 20, 2022

    @Pythonov

    This worked for me:

    Dockerfile:

    FROM centos/systemd:latest
    RUN yum -y install openssh-server openssh-clients
    CMD ["/bin/bash", "-c", "/usr/sbin/init"]

    Part of docker-compose:
    service_test:
    build:
    dockerfile: service_dockerfile
    cap_add: [NET_ADMIN]
    privileged: true
    container_name: service_test
    hostname: service_test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions