Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUILDKIT_SANDBOX_HOSTNAME build-arg #776

Closed
wants to merge 1 commit into from

Conversation

crazy-max
Copy link
Member

@crazy-max crazy-max commented Sep 21, 2021

Fixes #474

FROM alpine
RUN echo "HOSTNAME envvar: $HOSTNAME" && \
  echo "hostname: $(hostname)" && \
  echo "kernel: $(cat /proc/sys/kernel/hostname)"  && \
  echo "/etc/hosts: $(cat /etc/hosts)"
$ docker buildx build --build-arg "BUILDKIT_SANDBOX_HOSTNAME=myhostname" .
...
#6 [2/2] RUN echo "HOSTNAME envvar: $HOSTNAME" &&   echo "hostname: $(hostname)" &&   echo "kernel: $(cat /proc/sys/kernel/hostname)"  &&   echo "/etc/hosts: $(cat /etc/hosts)"
#6 0.166 HOSTNAME envvar: myhostname
#6 0.166 hostname: myhostname
#6 0.167 kernel: myhostname
#6 0.168 /etc/hosts: 127.0.0.1  localhost myhostname
#6 0.168 ::1    localhost ip6-localhost ip6-loopback
#6 DONE 0.2s

@tonistiigi Do we need to add this into the Dockerfile frontend as well? ("build-arg:BUILDKIT_SANDBOX_HOSTNAME")

Signed-off-by: CrazyMax [email protected]

@tonistiigi
Copy link
Member

Do we need to add this into the Dockerfile frontend as well?

I think it should just be in frontend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add build option "--hostname" for buildx to be able to customize hostname during build image
3 participants