How to configure proxy on the user level docker?

This is my setup:
Windows host -> RancherOS on Virtualbox.

When trying to add a container to my docker, I get this:

[docker@rancher-os ~]$ docker run -d --restart=always -p 8080:8080 rancher/server
Unable to find image 'rancher/server:latest' locally
Pulling repository docker.io/rancher/server
Network timed out while trying to connect to https://index.docker.io/v1/repositories/rancher/server/images. You may want to check your internet connection or if you are behind a proxy.

How can I configure the proxy?

(Things that I’ve tried)

  • I tried setting up http_proxy env var.
  • I tried configuring it on /var/lib/rancher/conf/docker by appending export http_proxy=myproxy

We lay out the instructions of how to configure Docker to set up a proxy, but overall Rancher needs no special configuration for proxy. You are specifically configuring Docker to work behind a proxy.

http://docs.rancher.com/rancher/faqs/#how-do-i-run-rancher-and-my-hosts-behind-a-proxy

Exactly, I just need to configure a proxy on Docker.
I did this on my linux install, however there is no /etc/default/docker on RancherOS, so my question is targeted to how to do it on RancherOS.

I created the /etc/default/docker, but how do I restart the user docker on RancherOS?

If you want to try an RC build of v0.4 this is now possible with by setting in your cloud config the following

#cloud-config
rancher:
  docker:
    environment:
    - HTTP_PROXY=http://myproxy
    - HTTPS_PROXY=https://myproxy

or

ros config set rancher.docker.environment '[HTTP_PROXY=http://myproxy,HTTPS_PROXY=https://myproxy]'

Also, to restart user docker in RancherOS. It should be as simple as restarting a the docker container in system-docker. We tested in v0.4.0.

Thanks everyone for your responses and sorry for not getting back earlier.

I’m running rancher-os v0.4.0-rc6.

I tried setting the proxy via ros config... and verified that my proxy was indeed written to /var/lib/rancher/conf/cloud-config-local.yml :wink:. I also tried restarting the rancher-os vm.

But still, can’t wget google.com inside rancher-os… Any other ideas?

Can you check that when you do a sudo ros config export -f that the proxy is set in the docker container?