I have seen many solutions, but they are not friendly to novices and are not particularly clear
Error content:
System has not been booted with systemd as init system (PID 1). Can’t operate.
Failed to connect to bus: Host is down
Solution:
docker run -itd –privileged –name myCentos centos /usr/sbin/init
After creation: use the following command to enter the container
docker exec -it myCentos /bin/bash
Pay special attention to the bold content and don’t forget
The reason is that/bin/Bash is executed in the first step by default, and systemctl cannot be used because of a bug in docker
Therefore, we use/usr/SBIN/init and — privileged, so that we can use systemctl, but override the default/bin/bash
Therefore, if we want to enter the container, we can no longer use docker attach mycentos
Instead, you can only use docker exec -it myCentos /bin/bash Because exec allows us to execute the overridden default command/bin/bash
At the same time -it is also necessary
Similar to Ubuntu, the init directory may be different
Of course, I don’t know the specific bug. I hope it will be fixed in the future
Similar Posts:
- Docker OCI runtime exec failed: exec failed: container_linux.go:344: starting container process caus
- [Solved] OCI runtime exec failed……executable file not found in $PATH”: unknown
- [Solved] OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: “/bin/bash”: stat /bin/bash: no such file or directory: unknown
- Failed to get D-Bus connection: Operation not permitted [docker Install centos7]
- [Solved] Failed to get D-Bus connection: Operation not permitted
- Docker Container Error:Failed to get D-Bus connection: Operation not permitted
- docker: Error response from daemon: Conflict. The container name “/xx” is already in use
- “Failed to get D-Bus connection” appears when docker runs the command
- After installing node on MAC, enter node – V to prompt node command not found
- Install a docker container in centos7 that can log in SSH