Skip to content

Fix: Failed to get D-Bus connection: Operation not permitted

  • by
  • 2 min read

Docker containers are a great way to run separate cloud applications. However, as easy as Docker is to use, it can sometimes throw up rather weird error messages, leaving even the most experienced programmers scratching their heads. 

In this article, we’re talking about the “Failed to get D-Bus connection: Operation not permitted” error in Docker, its causes and what you can do to fix the problem.

What causes the “Failed to get D-Bus connection: Operation not permitted” error?

The error can be triggered by multiple reasons. Some common causes include:

  • The container is non-privileged
  • The command doesn’t have the system access required to run properly
  • Internet connectivity issues
  • Internal network issues

Also read: How to fix libGL error: failed to load driver: swrast?

How to fix the “Failed to get D-Bus connection: Operation not permitted” error?

Here are two fixes you can try out.

Check your network

If you’re running the command on your local network, check to see if the host and the client machine can communicate with each other freely without any firewalls or antivirus programs interfering with the connection. If you’re trying to access a remote client over the internet, check to see if you have internet connectivity and if the remote client is available. 

Check container privilege 

If the container you’re running interacts or attaches with a shell and uses systemd, it requires the CAP_SYS_ADMIN capability. However, Docker drops that capability with any non-privileged containers to enhance security. You can sidestep this by adding the –privileged flag to your Docker build command as follows. 

docker run --privileged {Image ID} /usr/sbin/init

Additionally, if you then want to access root in container, use the following command. 

systemctl start httpd.service

Also read: 4 ways to fix Docker: Error response from daemon: missing or empty content-length header

Yadullah Abidi

Yadullah Abidi

Yadullah is a Computer Science graduate who writes/edits/shoots/codes all things cybersecurity, gaming, and tech hardware. When he's not, he streams himself racing virtual cars. He's been writing and reporting on tech and cybersecurity with websites like Candid.Technology and MakeUseOf since 2018. You can contact him here: