'Can't login to private docker registry it says Error response from daemon: 502 Bad Gateway

can't login to private docker registry it says Error response from daemon: login attempt to http://hostname:5000/v2/ failed with status: 502 Bad Gateway

in /etc/hosts added ip and hostname

in /etc/docker/daemon.json added

{
  "insecure-registries" : ["hostname:5000"]
}

restarted docker but still error is coming please help me out

I know the problem http://hostname:5000/v2/ is not valid it should be https://hostname:5000/v2/ but I am not sure how to redirect to https



Solution 1:[1]

Had a similar issue when deploying a Docker application to QA environment in Jenkins.

Here's how I solved it: for me it was a temporary connectivity issue. All I had to do was retry the deployment process again in Jenkins after 1 to 2 minutes and it worked fine.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 halfer