Skip to content

Feature Request: add --add-host=[] option to docker build  #30096

Closed
@twang2218

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:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    area/builderkind/featureFunctionality or other elements that the project doesn't currently have. Features are new and shiny

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions