How to set environment variables for docker daemon?

Recommended Posts

I'm trying to set up a registry proxy for the docker daemon. According to the instructions here, it is normally set using a systemd file. I have found that in unraid, simply setting the environment variables in a shell window and then using '/etc/rc.d/rc.docker restart' will properly get docker using the registry proxy.


My question is: How can I set the environment variables globally on boot so that the docker daemon recognizes them upon startup? Setting the variables in my go file or in does not work. After a reboot, the variable is set (from only), but docker doesn't use it until I manually restart it from the command line.


EDIT: For anyone else who ever wants to do this, I figured it out. There's a file on the flash drive at /boot/config/docker.cfg. Add the below lines to that file and your docker daemon will use a proxy.

export HTTP_PROXY=""
export HTTPS_PROXY=""


Edited by hasown
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.