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:
- [Solved] Docker Error: got permission denied while trying to connect to the docker daemon socket at…
- How to Fix ERROR Couldn’t connect to Docker daemon at http+docker://localunixsocket
- Docker Build Error: Failed to get D-Bus connection: Operation not permitted [Solved]
- RabbitMQ:address (cannot connect to host/port) [How to Solve]
- [Solved] error during connect: This error may indicate that the docker daemon is not running
- Centos7 hive started to report an error. There is no route to the host. The firewall has been closed
- [Solved] CentOS build a docker error: job for docker.service failed….
- How to Solve Docker failed to initialize Error
- [Solved] docker failed to solve: failed to solve with frontend dockerfile.v0: failed to create LLB definition
- How to Solve Fopen bus error
- Docker Open Error: Warning: docker.service changed on disk. Run ‘systemctl daemon-reload‘ to reload unit
- [Solved] docker Error: bridge docker0 failed: exchange full
- Failed to parse host mirrors.opencas.cn [How to Solve]
- [Solved] Docker Start Error: iptables failed: iptables –wait -t nat -A DOCKER -p tcp -d 0/0 –dport 10241
- [Solved] ERROR RocketmqCommon-Failed to obtain the host name
- Docker service startup error: Job for docker.service failed because the control process exited with error code.
- [Solved] Docker failed to start daemon: error initializing graphdriver: driver not supported
- MAC: How to modify the docker container error [screen is terminating]
- [Solved] System.InvalidOperationException: Failed to deploy distro docker-desktop……
- Failed to connect to driver at XXXXXXx