出于好奇心,在Docker中安装了Centos7系统,想搭建一个集群做测试。但是遇到了很多问题,例如下面几个。
这就很烦人了,翻遍了百度,看到了这一篇解决了: https://blog.csdn.net/weixin_39726347/article/details/86981919
以下是个人对过程的总结:
如果没在Docker中安装Centos7的话,可以移步到:https://blog.csdn.net/qq_17623363/article/details/103232731
[root@dfe2afa95f5c /]#
[root@dfe2afa95f5c /]# hostname os2
hostname: you must be root to change the host name
[root@dfe2afa95f5c /]#
[root@dfe2afa95f5c /]#
[root@dfe2afa95f5c /]# systemctl start httpd
Failed to get D-Bus connection: Operation not permitted
[root@dfe2afa95f5c /]#
docker ps -a
docker stop dfe2afa95f5c
docker rm dfe2afa95f5c
使用特权模式运行:docker run -itd --name os2 --privileged=true -p 10002:2 57fec878db54 /usr/sbin/init
我之前的命令:docker run -itd --name os1 -p 10000:22 87bd98509c5e /bin/bash
可以很明显的看出区别
很OK