Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

206
Views
Is it possible to specify build options from within a Dockerfile to control the build process?

Consider a the following docker command, which builds an image from a Dockerfile:

docker image build --network host -t test -f Dockerfile .

Is it possible to specify options of docker image build in the Dockerfile instead of the command-line (in this case --network host)?

This could be useful, since the host running docker image build ... uses a set of fixed flags, which would overriden by custom flags.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

In general, no.

In this particular case (network access): kinda, actually, using BuildKit, a new build system for Docker.

If you're using BuildKit (export DOCKER_BUILDKIT=1) you can add a comment at the top of the Dockerfile to enable newer syntax. And you can specify different versions of the syntax, which basically works by downloading a new builder, implemented a Docker image.

(A lot more details here: https://pythonspeed.com/articles/docker-buildkit/).

The latest experimental BuildKit syntax has an option for setting network access per build step. Scroll to bottom of https://hub.docker.com/r/docker/dockerfile/ for details, but short version:

  1. Add #syntax=docker/dockerfile:1.2-labs as first line of Dockerfile.
  2. Change RUN mycommand to RUN --network=host mycommand.
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!