8
docker 容器里使用systemctl命令
source link: http://abcdxyzk.github.io/blog/2020/11/06/docker-systemctl/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
docker 容器里使用systemctl命令
2020-11-06 17:11:00
error 1
bash: service: command not found
yum install initscripts -y
error 2
System has not been booted with systemd as init system (PID 1). Can’t operate.
容器的命令:
docker run -d --name centos_1 -it centos:latest /bin/bash
需要修改为
docker run -tid --name centos_1 --privileged=true centos:latest /sbin/init
也就是加–privileged=true,修改/binbash 为/sbin/init
Posted by kk
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK