diff --git a/dockers/docker-sonic-mgmt/Dockerfile.j2 b/dockers/docker-sonic-mgmt/Dockerfile.j2 index be2f1b6518b..f9578cba45a 100644 --- a/dockers/docker-sonic-mgmt/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -96,3 +96,14 @@ RUN tar -xvzf azure-cli_bundle.tar.gz RUN azure-cli_bundle_*/installer RUN git clone https://github.com/Azure/sonic-mgmt + +# Forward all proxy settings from 'docker run' command line to container scope startup script. +# So even ssh client has them. All env variables are optional +# Sample command: +# docker run -e "http_proxy=ip1" -e "ftp_proxy=ip2" -it +# +ENTRYPOINT bash -c "sudo touch /etc/profile.d/proxy.sh \ + && echo 'export http_proxy=${http_proxy}' | sudo tee -a /etc/profile.d/proxy.sh \ + && echo 'export https_proxy=${https_proxy}' | sudo tee -a /etc/profile.d/proxy.sh \ + && echo 'export ftp_proxy=${ftp_proxy}' | sudo tee -a /etc/profile.d/proxy.sh \ + && bash"