Skip to content

Support extra_hosts in _CLIBuilder #7323

@tomaszzielinski

Description

@tomaszzielinski

Is your feature request related to a problem? Please describe.

I'm using v2.4 yml as I need to pass extra_hosts to the builder and v3 doesn't seem to support that (yet). I'm evaluating using docker-compose with BuildKit but it seems that extra_hosts are not propagated all the way to the Docker CLI [1].

[1] https://github.com/docker/compose/blob/1.26.0-rc3/compose/service.py#L1790-L1802

Describe the solution you'd like

It would be great if _CLIBuilder made use of extra_hosts, as they seem to be properly passed down to it [2].

[2] https://github.com/docker/compose/blob/1.26.0-rc3/compose/service.py#L1085-L1100

Describe alternatives you've considered

I tried mounting my own hosts file on top of /etc/hosts but it doesn't seem to be possible inside a "normal" (i.e. unpriviledged, etc.) container.

I also thought about patching docker-compose locally & maintaining a fork, but it doesn't really make sense given that the default (non-CLI) builder works correctly and that I don't stricly need BuildKit (it was meant to be a nice bonus).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions