Docker下使用centos无法使用systemctl怎么办

提交正在使用的容器: docker commit [ContainerId]
提交停止正在运行无法使用Systemctl的容器: docker stop [ContainerId]
删除这个容器(可选): docker rm [ContainerId]

通过刚刚提交的镜像重启容器, 注意启动命令

docker run -itd --name dev-centos --privileged=true dev/centos:latest /usr/sbin/init

注意: 一定要加上 --privileged=true

exec进入交互终端: docker exec -it dev-centos /bin/bash

使用systecmctl

posted @ 2020-07-30 14:00  Laggage  阅读(448)  评论(0编辑  收藏  举报