After using CentOS 7 image to create a container, you may encounter such a problem that you use systemctl to start the service and report an error. For this error report, let’s analyze it next!
# docker run -itd –name centos7 centos:7
# docker attach centos7
# yum install vsftpd
# systemctl start vsftpd
Failed to get D-Bus connection: Operation not permitted
The reasons are as follows:
The design concept of docker is that there is no background service running in the container. The container itself is an independent main process on the host, which can also be indirectly understood as the application process running the service in the container. The life cycle of a container exists around the main process, so the correct way to use the container is to run the services in the foreground.
When it comes to SYSTEMd, this suite has become the default service management for mainstream Linux distributions (such as centos7 and Ubuntu 14 +), replacing the traditional Systemv style service management. SYSTEMd maintains system services, which require privileges to access the Linux kernel. The container is not a complete operating system, there is only one file system, and the default startup is only for ordinary users to access the Linux kernel, that is, there is no privilege, so it can’t be used naturally!
Therefore, please follow the container design principles and run a foreground service in one container!!!
Yes, run the container in privileged mode.
The solution is as follows:
Create container:
# docker run -d -name centos7 –privileged=true centos:7 /usr/sbin/init
Enter container:
# docker exec -it centos7 /bin/bash
This allows you to start the service using systemctl
Read More:
- [Solved] “Failed to run kubelet“ err=“failed to run Kubelet: misconfiguration: kubelet cgroup driver: \“cgrou
- [Solved] CentOS build a docker error: job for docker.service failed….
- How to Solve kubelet starts error (k8s Cluster Restarted)
- [Solved] Docker Error: Failed to connect to bus: Host is down
- Docker service startup error: Job for docker.service failed because the control process exited with error code.
- Docker Open Error: Warning: docker.service changed on disk. Run ‘systemctl daemon-reload‘ to reload unit
- Docker run Error: container_linux.go:235: starting container process caused “process_linux.go:258: appl
- [Solved] k8s kubeadmin init Error: http://localhost:10248/healthz‘ failed
- [Solved] Docker Startup Error: panic: runtime error: invalid memory address or nil pointer dereference
- [Solved] K8s Initialize Error: failed with error: Get “http://localhost:10248/healthz“
- [Solved] ERROR: for jms_koko Cannot start service koko: driver failed programming
- [Solved] Docker startup container error: permission denied””: unknown.
- [Solved] Rsync synchronization Error: @ERROR: Unknown module xxx
- How to Solve VMware Workstation Error: The VMware Authorization Service is not running.
- [Solved] kubelet Startup Error: cannot find network namespace for the terminated container
- ubuntu docker dm_task_run failed error [How to Solve]
- How to Solve k8s Nodal issues: /sys/fs/cgroup/memory/docker: no space left on device\““: unknown.
- [Solved] Kibana Error: Kibana server is not ready yet
- [Solved] Postgres Start Error: Job for postgresql.service failed because the control process exited with error code.
- [Solved] Error in installing docker requires: fuse overlayfs >= 0.7