Skip to content

Commit

Permalink
Merge pull request moby#27702 from tonistiigi/net-builder0
Browse files Browse the repository at this point in the history
add --network option for docker build
  • Loading branch information
thaJeztah authored Oct 26, 2016
2 parents d5d520f + 3c9dff2 commit 4c4545c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions command/image/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ type buildOptions struct {
cacheFrom []string
compress bool
securityOpt []string
networkMode string
}

// NewBuildCommand creates a new `docker build` command
Expand Down Expand Up @@ -105,6 +106,7 @@ func NewBuildCommand(dockerCli *command.DockerCli) *cobra.Command {
flags.StringSliceVar(&options.cacheFrom, "cache-from", []string{}, "Images to consider as cache sources")
flags.BoolVar(&options.compress, "compress", false, "Compress the build context using gzip")
flags.StringSliceVar(&options.securityOpt, "security-opt", []string{}, "Security options")
flags.StringVar(&options.networkMode, "network", "default", "Connect a container to a network")

command.AddTrustedFlags(flags, true)

Expand Down Expand Up @@ -302,6 +304,7 @@ func runBuild(dockerCli *command.DockerCli, options buildOptions) error {
Labels: runconfigopts.ConvertKVStringsToMap(options.labels.GetAll()),
CacheFrom: options.cacheFrom,
SecurityOpt: options.securityOpt,
NetworkMode: options.networkMode,
}

response, err := dockerCli.Client().ImageBuild(ctx, body, buildOptions)
Expand Down

0 comments on commit 4c4545c

Please sign in to comment.