Sometimes, if you are behind a corporate proxy - docker pull fails to download images from dockerhub with an error like below:
$ sudo docker pull swaggerapi/swagger-codegen-cli
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: read tcp 10.0.2.15:50136->3.223.220.229:443: read: connection reset by peer
You can check if the image is in your private registry by prepending the private docker hub before the image and checking if it works.
docker pull docker-hub.docker.myorg.com/swaggerapi/swagger-codegen-cli
In this case, you can edit your ~/.docker/daemon.json to contain an entry for registry-mirrors
{
"debug" : true,
"experimental" : false,
"registry-mirrors" : [
"https://docker-hub.docker.myorg.com"
]
}