Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

200
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda