[Solved] Docker Error: Failed to connect to bus: Host is down

docker run -itd –privileged –name=apache -v /var/www/html/:/var/www/html/ -p 8888:80 myapache:v1 /usr/sbin/init

Remember, remember

Error content:

The 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 it

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.


Read More: