When boot2docker was changed to docker-machine, it added dubious feature of being read only container, so no
changes to VirtualBox will be preserved after restart. Saving changes is still perfectly fine for Linux Docker users, but
not docker-machine users anymore for some reason.
So, to add new hostname before, you could just go to VirtualBox, change /etc/hosts file, and this is it - this will not work with docker-machine, as hosts file will be erased after restart. You are luckier, if you are not using net:host in docker-compose, there is special property for that too. But, if you are using net:host, the only working option is to change VirtualBox image and add this configuration:
In this case it will use host machine to resolve all dns requests, even those from /etc/hosts.
So, to add new hostname before, you could just go to VirtualBox, change /etc/hosts file, and this is it - this will not work with docker-machine, as hosts file will be erased after restart. You are luckier, if you are not using net:host in docker-compose, there is special property for that too. But, if you are using net:host, the only working option is to change VirtualBox image and add this configuration:
VBoxManage modifyvm "default" --natdnshostresolver1 on
In this case it will use host machine to resolve all dns requests, even those from /etc/hosts.
No comments:
Post a Comment