Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

196
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda