Docker: setup proxy to download images

I need setup the corporation proxy in order Docker can download the images from public registry.

$ sudo docker run hello-world 
Unable to find image 'hello-world:latest' locally 
Pulling repository docker.io/library/hello-world 
Error while pulling image: Get https://index.docker.io/v1/repositories/library/hello-world/images: dial tcp: lookup index.docker.io: no such host

I’m using Ubuntu 12.04 machine. I have found this answer but systemctl is not present in Ubuntu 12.04. How can I do this?

  • xdebug in phpstorm and docker
  • What server URL should one provide for TeamCity agent in Docker?
  • Stylesheet served from nginx in docker not available on page
  • Why host is not hitting web app in docker container even with -P option?
  • Can Docker Compose build a ZooKeeper discovery service for Swarm?
  • Docker on the mac separates internal and external file ownerships; not so on linux
  • Thanks.

  • Pull jobs directory from a repository into Jenkins from a Dockerfile
  • Monolithic (vs) Micro-services ==> Threads (vs) Process
  • Docker: mounting volumes from other docker service (not container)
  • How to pass docker arguments during docker run command or docker-compose up command
  • Docker run nanoserver not starting
  • docker-compose restart always not issuing run command
  • 2 Solutions collect form web for “Docker: setup proxy to download images”

    I was getting the following error while trying to run the hello-world container

    $docker run hello-world
    Unable to find image 'hello-world:latest' locally
    docker: Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp 34.205.194.204:443: getsockopt: no route to host.
    

    I tried the steps in the following link which worked for me with respect to HTTPS or HTTP configuration

    https://docs.docker.com/engine/admin/systemd/#httphttps-proxy

    Edit /etc/defaults/docker.io and add the following lines:

    export http_proxy='http://user:password@proxy-host:proxy-port'
    

    Then restart docker daemon:

    sudo service docker.io restart
    

    Source

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.