title: How to run yum inside a docker container on a partially isolated host?
body: <p>I have a machine that is on a semi-isolated network. I have to use proxy to connect to the internet. I have verified that on my host, after I set http_proxy environment variable, I can receive update from public yum repository.</p>
  
  <p>Now I am trying to do the same thing inside a docker container on my machine, but it doesn't seem to work.</p>
  
  <pre><code>$docker run --rm -it --net=host rhel /bin/bash
  [root@MyCont] http_proxy=http://myproxy:1234/
  [root@MyCont] echo -e "[base] \nname=CentOS-7 - Base - centos.com\nbaseurl=http://mirror.centos.org/centos/7/os/\$basearch/\ngpgcheck=1\ngpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7" &gt; /etc/yum.repos.d/CentOS7-Base-centos.repo \
  &amp;&amp; yum clean all \
  &amp;&amp; yum install -y openssh-server  openssh-clients
  </code></pre>
  
  <p>I brought up my container in host network mode, so I assume I should have the same network stack as my host in my container. Therefore, if I set the http_proxy properly, I should have the same yum behavior inside and outside container.</p>
  
  <p>Is it possible to run yum inside a docker container whose host is on a semi-isolated network that needs http_proxy to access yum?</p>