I have a Centos machine with OpenVZ containers. For each container I have an alias in /etc/hosts
. I would like to be able to share the /etc/hosts
between the root and the containers. Is there a way to do it?
Thanks.
What do you mean by sharing? Do you want all containers to have the same /etc/hosts? It's not a good idea because it should contain a hostname. But if you want to be able to view it's contents inside a container then you can do use mount --bind
from a host:
mount --bind /etc/hosts ${VE_ROOT}/root/shared_etc_host
You can use a configuration deployment mechanism like Chef, Ansible or Puppet to deploy consitent /etc/hosts
file in your env.