Skip to content

Allow azd up to use host network during docker build #4758

Description

@surajssd

Right now there is no way to tell azd up to use --network=host when it does docker build behind the scene. It would great if azd added a way for the users to ask it to use host network when doing the docker build.


Right now my workaround is to get create a script called docker and put it into the PATH before the actual docker binary. And the script does this:

#!/usr/bin/env bash

set -euo pipefail

DOCKER_BIN="/usr/bin/docker"

# Check if we are calling docker build only then we will use the --network=host flag
if [ "$1" == "build" ]; then
    shift
    exec "${DOCKER_BIN}" build --network=host "$@"
fi

exec "${DOCKER_BIN}" "$@"

The flag would ideally go in this list:

args := []string{
"build",
"-f", dockerFilePath,
"--platform", platform,
}

Metadata

Metadata

Labels

area/core-cliCLI commands, cmd/, internal/cmd/enhancementNew feature or improvement

Fields

No fields configured for Feature.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions