Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mount /etc/hosts as read write #1959

Closed
wants to merge 1 commit into from
Closed

Mount /etc/hosts as read write #1959

wants to merge 1 commit into from

Conversation

fabiofalci
Copy link
Contributor

Fix #1951 - Unable to modify /etc/hosts file in a container

Fix 1951 - Unable to modify /etc/hosts file in a container
@ghost ghost assigned shykes Sep 21, 2013
@keeb-zz
Copy link
Contributor

keeb-zz commented Sep 21, 2013

cc @shykes, this issue was automatically assigned to you by Gordon

@vieux
Copy link
Contributor

vieux commented Sep 23, 2013

I think this is not that easy, if you do this, on commit, the modifications on /etc/host won't be saved.

/cc @creack @crosbymichael

@fabiofalci
Copy link
Contributor Author

You're right, just tested.

I'll see if i can fix this.

@tianon
Copy link
Member

tianon commented Sep 23, 2013

I believe the issue here is that every time you run the image, the hostname changes, so /etc/hosts has to change to match, which means your own changes would have to be blown away. Would it be difficult to add something like /etc/hosts.before and/or /etc/hosts.after that automatically get added to the readonly version on run? I'm not saying I see a clear use case for it, but it's certainly an option to consider if adding to /etc/hosts arbitrarily is something we decide is a good thing for images to be able to do.

@creack
Copy link
Contributor

creack commented Sep 23, 2013

the @tianon proposal could work, even though not ideal.
But we won't be able to mount /etc/hosts in RW as it is implemented right now. If we were to do that, the container could pollute the host.

@fabiofalci
Copy link
Contributor Author

Right, it's not an easy fix so I decided to use dnsmasq instead.
Please see #1951 (comment)

@crosbymichael
Copy link
Contributor

@fabiofalci Are you still interested in completing this?

@fabiofalci
Copy link
Contributor Author

@crosbymichael clearly my pull request is not enough and my workaround is working for me.

And it seems we have more thing to do about these files, issue #2267.
So I think you can close this pr.

@crosbymichael
Copy link
Contributor

@fabiofalci Thanks for following up with this.

@fabiofalci fabiofalci deleted the 1951-etc-hosts-as-rw branch February 20, 2014 23:37
@GordonWang
Copy link

Hi guys,

Is this change available in 0.11.1?
I use 0.11.1 to build a image, but looks like /etc/hosts is still read only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to modify /etc/hosts file in a container
8 participants