docker获取centos镜像,里面执行安装lnmp之后 发现使用systemctl无法使用
[[email protected] /]# systemctl restart nginx
Failed to get D-Bus connection: Operation not permitted
解决办法
1: docker stop 92926bd84d70
2: docker export 92926bd84d70 > centos_lnmp_laster.tar
3:cat centos_lnmp_laster.tar | docker import - centos_lnmp
4: docker run --privileged -itd -p 8088:80 -p 33006:3306 c5062bdb9131 /usr/sbin/init
docker ps -a查看启动镜像
[email protected]:/data# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1850715a5140 c5062bdb9131 "/usr/sbin/init" 28 minutes ago Up 28 minutes 0.0.0.0:8088->80/tcp, 0.0.0.0:33006->3306/tcp trusting_goldberg
docker exec登陆
[email protected]:/data# docker exec -it 1850715a5140 /bin/bash
[[email protected] /]# systemctl restart nginx
[[email protected] /]#
原文地址:http://blog.51cto.com/9025736/2332738
时间: 2024-10-13 03:34:05