Last active
February 17, 2024 10:13
-
-
Save sergiobuj/b1376d8385c0be2deac729ee64dc6b63 to your computer and use it in GitHub Desktop.
troubleshoot docker ENV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:latest | |
ENV no_proxy internal.example.com,internal2.example.com | |
ENV NO_PROXY internal.example.com,internal2.example.com | |
RUN apk update && apk upgrade |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM base_alpine:latest | |
ENV no_proxy itworks | |
ENV NO_PROXY itworks | |
RUN echo ${no_proxy} | |
RUN echo ${NO_PROXY} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:latest | |
ENV no_proxy internal.example.com,internal2.example.com | |
ENV NO_PROXY internal.example.com,internal2.example.com | |
RUN apt update && apt upgrade -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM base_ubuntu:latest | |
ENV no_proxy itworks | |
ENV NO_PROXY itworks | |
RUN echo ${no_proxy} | |
RUN echo ${NO_PROXY} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
export DOCKER_CLI_HINTS=false | |
# Build some base images | |
docker build . -f Dockerfile_ubuntu -t base_ubuntu | |
docker build . -f Dockerfile_alpine -t base_alpine | |
# Build the secondary images | |
docker build . -f Dockerfile_ubuntu_override -t overrider_ubuntu | |
docker build . -f Dockerfile_alpine_override -t overrider_alpine | |
# Test the env override | |
on_ubuntu=$(docker run overrider_ubuntu env | grep -i proxy) | |
on_alpine=$(docker run overrider_alpine env | grep -i proxy) | |
echo "on ubuntu the env var is: \n$on_ubuntu" | |
echo "on alpine the env var is: \n$on_alpine" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment