我有一个OpenVZ容器的Centos机器。 对于每个容器,我在/etc/hosts都有一个别名。 我希望能够在根和容器之间共享/etc/hosts 。 有没有办法做到这一点?
谢谢。
你分享什么意思? 你想要所有的容器有相同的/ etc / hosts吗? 这不是一个好主意,因为它应该包含一个主机名。 但是,如果你想能够查看它的容器内的内容,那么你可以使用从主机mount --bind :
mount --bind /etc/hosts ${VE_ROOT}/root/shared_etc_host
你可以使用像Chef,Ansible或Puppet这样的configuration部署机制来在你的env中部署consitent /etc/hosts文件。