docs icon indicating copy to clipboard operation
docs copied to clipboard

docker image build --network refers to netwoking type

Open turicas opened this issue 9 months ago • 2 comments
trafficstars

Is this a docs issue?

  • [x] My issue is about the documentation content or website

Type of issue

Information is incorrect

Description

The --network parameter of docker build image actually does not refer to a network, but to the networking mode for the RUN instructions during build. The semantics is not consistent in this case (and it sucks), since in docker run , the --network connects the container to a network (it should be called --networking-mode in docker build image).

In the compose docs there is an example showing how to add a custom network during the build phase (which is wrong) and doesn't explain that this parameter is actually for the networking mode (none, host, bridge):

build:
  context: .
  network: custom_network_1

Some references:

Location

https://docs.docker.com/reference/compose-file/build/#network

Suggestion

  • Remove custom_network_1 example
  • Clarify regarding service.build.network being networking mode and different from service.network

turicas avatar Feb 06 '25 19:02 turicas

There hasn't been any activity on this issue for a long time. If the problem is still relevant, mark the issue as fresh with a /remove-lifecycle stale comment. If not, this issue will be closed in 14 days. This helps our maintainers focus on the active issues.

Prevent issues from auto-closing with a /lifecycle frozen comment.

/lifecycle stale

docker-robot[bot] avatar Jun 05 '25 01:06 docker-robot[bot]

/remove-lifecycle stale

turicas avatar Jun 05 '25 01:06 turicas