1

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.

1
  • Why the downvote?
    – Vojtěch
    Commented Oct 15, 2014 at 19:50

2 Answers 2

1

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
0

You can use a configuration deployment mechanism like Chef, Ansible or Puppet to deploy consitent /etc/hosts file in your env.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .