Docker Behind a Proxy in a Shared Computer

I am using nvidia-docker in an Ubuntu 18.04 shared server behind a corporate proxy. I tried to build a docker image using the:

nvidia-docker build --build-arg http_proxy=http://credential@host:port --build_arg https_proxy=http://credential@host.port -t image_name .

But it always gives me:

Get Proxy Authentication Required

I tried to set the environment variables separately as:

export http_proxy=…
export https_proxy=…
export HTTP_proxy=…
export HTTPS_PROXY=…

But all the above didn’t work and the same error message comes again!

The error message comes aslo with “docker” not just “nvidia-docker”

Setting the proxy in system files like /etc/default/docker is not an option for me as the computer is shared and this will disclose my credentials.

Any solution for this please?