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
docker build --add-host is not working #34078
Comments
|
I just replied on the other issue #30383 (comment) ;
This is working as designed, so i'll close this, but feel free to continue the discussion |
|
@thaJeztah thanks for the answer! I think your one sentence should be added to the documentation for clarification. What I was looking for was the |
|
@jpuck could you elaborate? it's documented in the |
|
oh! you meant my sentence: perhaps you're interested in contributing, and opening a pull request? the markdown file used to generate that page in the documentation can be found here; https://github.com/docker/cli/blob/master/docs/reference/commandline/build.md |
|
@thaJeztah is this still true ? can you answer my question? (https://stackoverflow.com/questions/53555902/question-for-docker-build-add-host-command) and is there a no way to add hosts for users who use images I created ? what is https://stackoverflow.com/a/46241945/6128380 , I am really confused. |
|
@Hokwang the same is still true #34078 (comment) / #30383 (comment) It's by design; the If it would persist in the image;
The person running an image should remain in control over overriding hosts, not the image author; it's a runtime configuration. Possible solutions For your situation;
|
I have just recently run:
docker build --add-host=docker:10.180.0.1 -t abs .
docker run -it abs sh
cat /etc/hosts
The new entry is not found in the hosts file - I have tried this on various images (alpine, jboss/wildfly). This was performed on Docker for Mac.
Interestingly this works though:
docker run -it --add-host=docker:10.180.0.1 abs sh
cat /etc/hosts
The text was updated successfully, but these errors were encountered: