Adding /etc/hosts entry to host machine on vagrant up

前端 未结 4 1705
花落未央
花落未央 2021-01-30 17:11

Is it possible for one to modify files on the host machine during the vagrant up process? For example, adding an entry to the host machine\'s /etc/hosts

4条回答
  •  隐瞒了意图╮
    2021-01-30 17:34

    The solution is to use vagrant-hostsupdater

    vagrant plugin install vagrant-hostsupdater
    

    This plugin adds an entry to your /etc/hosts file on the host system.

    On up and reload commands, it tries to add the information, if its not already existant in your hosts file. If it needs to be added, you will be asked for an administrator password, since it uses sudo to edit the file.

    On halt, suspend and destroy, those entries will be removed again.

提交回复
热议问题