Software⏱️ 2 min read📅 2026-05-31

How to Fix: systemctl failed to connect to bus - docker ubuntu:16.04 container

Failed to connect to bus: No such file or directory in Ubuntu 16.04 Docker container.

Quick Answer: The issue is likely due to the lack of a system bus in the Docker container, which is required by systemctl. You can try running the command inside the container with the --systemd=container option.

The issue you're facing with systemctl failing to connect to the bus in a Docker container running Ubuntu 16.04 is due to the fact that Docker containers do not have a persistent system and therefore, they lack the necessary configuration files required for systemd to function correctly.

🛑 Root Causes of the Error

  • The container is missing the /etc/systemd/system.conf file which is required for systemctl to connect to the bus.

🔧 Proven Troubleshooting Steps

Method 1: Mounting the Host System's Configuration Files

  1. Step 1: Run docker run -it --mount type=bind,source=/etc/docker.io/overlayfs/containers:/root/.docker/overlayfs/containers/,target=/etc/systemd/system.conf to mount the host system's configuration files into the container.

Method 2: Using a Docker Image with systemd Configuration Pre-Configured

  1. Step 1: Use a Docker image that has systemd pre-configured, such as ubuntu:latest, and mount the host system's configuration files using the same method as in Step 1 of Method 1.

🎯 Final Words

By following these steps, you should be able to resolve the issue with systemctl failing to connect to the bus in your Docker container running Ubuntu 16.04.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions