Open
Description
Is this a docs issue?
- 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:
- Is "docker build --network=host" working as expected? - #3 by nickyayoub
- How to handle networking between containers at build time](https://forums.docker.com/t/how-to-handle-networking-between-containers-at-build-time/139018)
- DOCKER_BUILDKIT=1 prevents custom networks using docker build --network
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 fromservice.network