After I installed Docker, I test run it and it is showing me the following error message:
/media/master/github>docker run hello-world
Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: x509: certificate is valid for xxxx.xx.xxxxx.xxx, not registry-1.docker.io.
See 'docker run --help'.
I got the error because I'm behind a proxy server. Therefore, to resolve this issue, I set the proxy configurations in Docker as follows.
- Create a systemd drop-in directory for the docker service:
$ mkdir -p /etc/systemd/system/docker.service.d
- Create a file called /etc/systemd/system/docker.service.d/http-proxy.conf and add the HTTP_PROXY environment variable:
- Restart Docker:
systemctl daemon-reload systemctl restart docker
- Verify that the configuration has been loaded:
$ systemctl show --property=Environment docker Environment=HTTP_PROXY=http://proxy.example.com:80/
- Test run Docker: