kk Blog —— 通用基础

date [-d @int|str] [+%s|"+%F %T"]

docker 容器里使用systemctl命令

error 1

bash: service: command not found

1
yum install initscripts -y

error 2

System has not been booted with systemd as init system (PID 1). Can’t operate.

容器的命令:

1
docker run -d --name centos_1 -it  centos:latest /bin/bash

需要修改为

1
docker run -tid --name centos_1 --privileged=true centos:latest /sbin/init

也就是加–privileged=true,修改/binbash 为/sbin/init