creates the container with the centos7 image, inside which the systemctl startup service reports an error. For this error, we will analyze 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
cannot start the service, what happens?
can’t the container run the service!!
a:
Docker’s design concept is not to run background services 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 services in the container. The life cycle of a container revolves around the main process, so the correct way to use the container is to run the services inside in the foreground.
speaking of systemd, this suite has become the default service management for major Linux distributions (such as CentOS7, Ubuntu14+), replacing the traditional systemv-style service management. Systemd maintains the system server program, which requires privileges to access the Linux kernel. And the container is not a complete operating system, only a file system, and default boot is only ordinary users such permissions to access the Linux kernel, that is, no privileges, so naturally not use!
therefore, follow the container design principles and run a foreground service in a container!
, that’s how I want to run it, can’t I solve it?
answer: yes, run the container in privileged mode.
create container:
# docker run -d --name centos7 --privileged=true centos:7 /usr/sbin/init
into the container:
# docker exec -it centos7 /bin/bash
so you can start the service using systemctl.
Read More:
- Docker CentOS Failed to get D-Bus connection: Operation not permitted
- docker service Failed to get D-Bus connection: Operation not permitted
- Failed to get D-Bus connection: No such file or directory
- ADB remount failed: operation not permitted
- Solve Linux docker pull error get https://registry-1.docker.io/v2/ : Net / http: TLS handshake timeout
- java.net.SocketException: socket failed: EPERM (Operation not permitted)
- After adb is connected to an android phone, remount failed: operation not permitted when adb remount is a roundabout solution
- [Vue] install vuex, error: eperm: operation not permitted, rename
- Solve win10 docker:error during connect: Get https://192.168.99.100 : 2376 and error checking TLS connection
- EPERM: operation not permitted, symlink ‘../../’
- “NPM err! Error: eperm: operation not permitted” problem solving
- NPM install Error: EPERM: operation not permitted, mkdir solution
- npm ERR Error: EPERM:operation not permitted, rename
- npm ERR! Error: EPERM: operation not permitted, open ‘C:\Program Files\nodejs\node_ Solution to cache / xxx
- AVD FFmpeg avcodec_ A solution of open2 returning – 1 (operation not permitted)
- NPM report error: eperm: operation not permitted, unlink… Solution and clear cache_ modules
- docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled
- com.docker.osx.hyperkit.linux failed to start Exit code 1
- Error: EPERM: operation not permitted, mkdir ‘D:\nodejs\node_modules\npm\node_cache\_npx‘
- Get connection timeout retry: 1 MySQL errorcode 0, state 08s01 docker container accessing MySQL container is very slow and sometimes interrupted