Skip to content

Instantly share code, notes, and snippets.

@piersharding
Last active February 3, 2019 20:56
Show Gist options
  • Save piersharding/a921d2f6be23ad0e97392156753cd0e0 to your computer and use it in GitHub Desktop.
Save piersharding/a921d2f6be23ad0e97392156753cd0e0 to your computer and use it in GitHub Desktop.
Dockerfile --build-arg - behaviour of http_proxy
#!/bin/sh -x
# test using your own http_proxy value at build time
# there is a default ARG for http_proxy already available
IMG=test
docker rm -f ${IMG}
cat <<EOF | docker build --build-arg HTTP_PROXY=http://piers-work:3128 -t ${IMG} -
FROM ubuntu:18.04
ARG HTTP_PROXY=""
RUN echo "here is http_proxy: \$HTTP_PROXY"
ENV HOME /root
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install curl -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN export https_proxy=\$HTTP_PROXY && curl -vvv https://ska-registry.av.it.pt
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment