How can I get VSCode to use host networking during the build of the container? In devcontainer.json, I can set
"runArgs": ["--network=host"]
but that only applies to running the container. How can I get VSCode to use host networking during the build of the container?
The solution below no longer works. According to a GitHub issue you can use this instead:
"runArgs": [
"--network=host",
],
You need to add the following in your devcontainer.json file:
"build": {
"args": {
"network": "host"
}
}
This property will allow you to use the host network when building.
As of now, proper solution does not exist, correspondent PR is open: https://github.com/microsoft/vscode-remote-release/issues/3545
A workaround mentioned in this PR is using initializeCommand in combination with image:
"initializeCommand": "docker build --network host --tag my-image .",
"image": "my-image"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With