I use Ubuntu

Use the following command to pull the Docker image named busybox:

sudo docker pull busybox

You get the following error message:

Pulling the repository busybox 2014/04/16 09:37:07 Get index. The docker. IO/v1 / reposito… Dial TCP: lookup index.docker. IO on 127.0.0.1:53: no answer from server

My version of Docker:

Proxy I use:

$ sudo docker version

Go Version (Client): go1.2.1 Git commit (Client): Dc9c28f Server version: 0.10.0 Server API version: 1.10 Git commit (Server): dc9c28f Go version (Server): Go1.2.1 Last stable Version: 0.10.0

The agent I use:

The/etc/apt/apt. Conf Acquire: : HTTP: : proxy “http://192.168.1.1:3128/”. Acquire: : HTTPS: : proxy “https://192.168.1.1:3128/”. Acquire: : FTP: : proxy “ftp://192.168.1.1:3128/”. Acquire: : socks: : proxy “socks: / / 192.168.1.1:3128 /”;

The solution

Create a new directory:

mkdir /etc/systemd/system/docker.service.d

Create a file:

/etc/systemd/system/docker.service.d/http-proxy.conf

Add environment variables:

HTTP_PROXY environment variable:

[Service] Environment = “HTTP_PROXY=proxy.example.com: 80 /”

The Environment = “HTTP_PROXY=proxy.example.com: 80 /” The Environment = “NO_PROXY = localhost, 127.0.0.0/8, docker-registry.somecorporation.com”

Reload configuration:

$ sudo systemctl daemon-reload

$ sudo systemctl show –property Environment docker

Environment=HTTP_PROXY=proxy.example.com:80/

Restart Docker. The problem is resolved.

$ sudo systemctl restart docker