docker-hoster icon indicating copy to clipboard operation
docker-hoster copied to clipboard

File `/etc/hosts` is not being updated

Open danieldevsquad opened this issue 6 years ago • 5 comments

PS: Thanks for sharing this solution!!

After starting the container:

image

The log messages suggest that a new entry was created in my /etc/hosts, but for some reason it's not there.

image

Any ideas?

I am running it on Mac

danieldevsquad avatar Jul 03 '18 14:07 danieldevsquad

Having tried this out, my guess is the atomic nature in which it moves the file. Since the file is mounted through a VM and not via a symlink/hardlink or however docker does it on Linux, it's removing the link between the host and the file in the container in the VM.

nesl247 avatar Jan 16 '19 20:01 nesl247

Ok, figured more of it out. That isn't entirely the issue. It's also that /etc/hosts isn't shared by default with Docker for Mac. /private/etc/hosts is. If you change that part of the command, it will at least attempt to edit the right file. However, it will fail to move because of the previous issue I mentioned.

nesl247 avatar Jan 16 '19 21:01 nesl247

It seems like https://github.com/docker/for-mac/issues/483 is the cause?

baodrate avatar Jan 24 '19 22:01 baodrate

I don't believe that is related at all.

nesl247 avatar Jan 24 '19 22:01 nesl247

I have set write permission for current user to /private/etc/hosts and it works

vdroznik avatar Jun 17 '19 19:06 vdroznik