Docker Community Forums

Share and learn in the Docker community.

Trying to update proxy config file on Ubuntu container without vi so that I can download vi using apt-get through my proxy?


I have installed Docker on Windows 10, and ran a new ubuntu container.

Now on the container, I run ‘apt-get update’ and it says: Could not connect to (

Understandable, I am behind a proxy which I need to authenticate against.

According to this article:

I need to update the proxy.conf file with my proxy settings.

Great, but vi isn’t installed so I can edit the config file, and I cant install vi without using apt-get which needs me to edit the proxy.conf using vi…???

Now what?

Any ideas?

(Gary Forghetti) #2

Here’s an example. Change the http://user:password@proxy.server:port/ below to match what your proxy needs.

🐳  gforghetti@[~] $ sudo touch /etc/apt/apt.conf.d/proxy.conf
🐳  gforghetti@[~] $ echo 'Acquire::https::Proxy "http://user:password@proxy.server:port/";'| sudo tee -a /etc/apt/apt.conf.d/proxy.conf
Acquire::https::Proxy "http://user:password@proxy.server:port/";
🐳  gforghetti@[~] $ cat /etc/apt/apt.conf.d/proxy.conf
Acquire::https::Proxy "http://user:password@proxy.server:port/";
🐳  gforghetti@[~] $

Thank you, worked perfectly!

(Metin Y.) #4

What about the good old http_proxy enviornment variable? When set, apt-get uses it :slight_smile:


I only use Acquire::https::Proxy when a repository cache like apt-cacher-ng is available in the environment. This allows to use a different proxy for general web downloads and a specific configuration for the repository cache.

1 Like


I originally did try and use the environment variable:

export http_proxy=

However, it seemed to take the proxy host and port, however, ignored the authentication details (username & password). I kept getting 407 Authentication Required responses.

According to the link in my original post, it says: Aptitude will not use the HTTP Proxy environment variables. Instead, it has its own configuration file where you can set your proxy.

Perhaps this has something to do with it not using the authentication details.

This is why I was looking at how to update the proxy.conf file.


Although I am now getting further than before, it appears that some packages during download still say 407 Proxy Authentication Required.

root@8d9e473f6645:/# apt-get install vim
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
file libexpat1 libgpm2 libmagic-mgc libmagic1 libmpdec2 libpython3.6 libpython3.6-minimal libpython3.6-stdlib libreadline7 libsqlite3-0 libssl1.1 mime-support readline-common vim-common vim-runtime xxd xz-utils
Suggested packages:
gpm readline-doc ctags vim-doc vim-scripts
The following NEW packages will be installed:
file libexpat1 libgpm2 libmagic-mgc libmagic1 libmpdec2 libpython3.6 libpython3.6-minimal libpython3.6-stdlib libreadline7 libsqlite3-0 libssl1.1 mime-support readline-common vim vim-common vim-runtime xxd xz-utils
0 upgraded, 19 newly installed, 0 to remove and 3 not upgraded.
Need to get 12.7 MB of archives.
After this operation, 61.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 ttp:// bionic-updates/main amd64 libmagic-mgc amd64 1:5.32-2ubuntu0.1 [184 kB]
Ign:2 ttp:// bionic-updates/main amd64 libmagic1 amd64 1:5.32-2ubuntu0.1
Get:3 ttp:// bionic-updates/main amd64 file amd64 1:5.32-2ubuntu0.1 [22.1 kB]
Get:4 ttp:// bionic/main amd64 libexpat1 amd64 2.2.5-3 [80.2 kB]
Get:2 ttp:// bionic-updates/main amd64 libmagic1 amd64 1:5.32-2ubuntu0.1 [68.4 kB]
Get:5 ttp:// bionic/main amd64 libmpdec2 amd64 2.4.2-1ubuntu1 [84.1 kB]
Get:6 ttp:// bionic-updates/main amd64 libssl1.1 amd64 1.1.0g-2ubuntu4.3 [1130 kB]
Get:7 ttp:// bionic-updates/main amd64 libpython3.6-minimal amd64 3.6.7-1~18.04 [531 kB]
Err:8 ttp:// bionic/main amd64 mime-support all 3.60ubuntu1
407 Proxy Authentication Required [IP: 8080]
Get:9 ttp:// bionic/main amd64 readline-common all 7.0-3 [52.9 kB]
Get:10 ttp:// bionic/main amd64 libreadline7 amd64 7.0-3 [124 kB]
Get:11 ttp:// bionic/main amd64 libsqlite3-0 amd64 3.22.0-1 [496 kB]
Get:12 ttp:// bionic-updates/main amd64 libpython3.6-stdlib amd64 3.6.7-1~18.04 [1711 kB]
Get:13 ttp:// bionic/main amd64 xxd amd64 2:8.0.1453-1ubuntu1 [49.2 kB]
Get:14 ttp:// bionic/main amd64 vim-common all 2:8.0.1453-1ubuntu1 [70.4 kB]
Get:15 ttp:// bionic/main amd64 xz-utils amd64 5.2.2-1.3 [83.8 kB]
Get:16 ttp:// bionic/main amd64 libgpm2 amd64 1.20.7-5 [15.1 kB]
Get:17 ttp:// bionic-updates/main amd64 libpython3.6 amd64 3.6.7-1~18.04 [1415 kB]
Get:18 ttp:// bionic/main amd64 vim-runtime all 2:8.0.1453-1ubuntu1 [5437 kB]
Get:19 ttp:// bionic/main amd64 vim amd64 2:8.0.1453-1ubuntu1 [1152 kB]
Fetched 12.7 MB in 2s (5312 kB/s)
E: Failed to fetch ttp:// 407 Proxy Authentication Required [IP: 8080]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Why would some seem fine and other complain about proxy authentication?

(note in the above pasted trace I have removed the first ‘h’ from ‘http’ so it wouldnt be seen as a link and let me post this)


Strange, if I run apt-get install vim from directory “/etc/apt” then there are no proxy authentication issues?

(Metin Y.) #8

Actualy, I never thried it with a proxy that requires auth.

We use the http_proxy settings as --build-arg while building our containers. Without it apt-get can’t install a single package during the build.