最近用Docker在使用CentOS镜像的时候发现不能使用系统服务。
报以下错误
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
解决方法:
在启动镜像的时候用如下命令
docker run -itd --privileged --name myCentos centos /usr/sbin/init
进入容器
docker exec -it myCentos /bin/bash