Feature Request: add --add-host=[]
option to docker build
#30096
Closed
Description
docker run
has --add-host=[]
which is very handy, especially in the network environment without internal DNS. However, docker build
don't have --add-host=[]
option.
During the image building process, sometimes, we need to have specific name
, ip
mappings. Such as:
- accessing internal Git server via HTTP with internal domain name;
- accessing some websites (such as, GitHub repo) from inside of GFW, which often contaminated certain domain names;
- accessing internal HTTP API server with internal domain name;
There is a workaround by adding echo 1.2.3.4 >> abc.com /etc/hosts
in the begining of each RUN
command which has the problems, however it would be handy to have --add-host=[]
option in the docker build
command.
Related issues:
- docker build should support privileged operations #1916 (comment)
- Allow customization of /etc/hosts, /etc/resolv.conf, etc. in containers #2267
- Cannot append to /etc/hosts in a Dockerfile #3851
- Support --dns or --addn-hosts for docker build #5779
- Need Ability to set Host on Build! #7966
- Proposal: use *run* options when i *build* image #10171
- Please add --add-host=[], --net options to docker build #10324
- Support --dns or --addn-hosts for 'docker build' like 'docker run' #24928
Activity