I was trying to test my recent docker install on Debian 9 but the following error appeared:
root@gsdpuma:~# 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: lookup registry-1.docker.io on 184.108.40.206:53: no such host. See 'docker run --help'.
I had clear it was related to our corporate proxy and I was focused on that.
I’ve tried searching for the error but it had multiple solutions, reading the comments I’ve started digging in the filesystem looking for any docker related file, and I found this one:
/etc/systemd/system/multi-user.target.wants/docker.service #which is just a symlink to: lrwxrwxrwx 1 root root 34 Feb 10 14:53 docker.service -> /lib/systemd/system/docker.service
And added this on the file under the [Service] section:
[Service] #proxy added by mortiz Environment=HTTP_PROXY=http://12345.66.777:1234
After that restarted docker:
root@grrrrrr:/etc/systemd/system# service docker restart
Executed docker info to see that the proxy had been loaded correctly:
root@grrrrrr:/etc/systemd/system# docker info Client: Debug Mode: false Server: Containers: 1 Running: 0 Paused: 0 Stopped: 1 Images: 1 Server Version: 19.03.5 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Native Overlay Diff: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: asdasd runc version: asdasdasd init version: asdasdsad Security Options: seccomp Profile: default Kernel Version: 4.9.0-7-amd64 Operating System: Debian GNU/Linux 9 (stretch) OSType: linux Architecture: x86_64 CPUs: 2 Total Memory: 7.701GiB Name: grrrrr.domain ID: XXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXX Docker Root Dir: /var/lib/docker Debug Mode: false HTTP Proxy: http://12345.66.777:1234 HTTPS Proxy: http://12345.66.777:1234 Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false
And I succeeded running the test:
root@grrrrrrrrr:/etc/systemd/system# docker run hello-world Hello from Docker! This message shows that your installation appears to be working correctly