OS Version : RHEL 8.4 Docker Version : 20.10.6
I have deployed local container registry using command docker run -d -p 5000:5000 --restart=always --name registry registry:2
Used following config /etc/docker/daemon.json for using insecure registries
{
"insecure-registries" : [ "localhost:5000", "test123:5000" ]
}
My local hostname was set to : test123
But while connecting or pushing images to registry with hostnames, it fails
To test following curl command works with "localhost"
# curl http://localhost:5000/v2/_catalog
{"repositories":["testcontainerimage"]}
But it fails with hostname and times out
# curl http://test123:5000/v2/_catalog
Is there any way/workaround to access registry with hostname "test123" instead of "localhost"
Resolution
As per the Andrew's comment, issue was related to firewall
RHEL8 has changed firewall framework from iptables to nftables. Hence I disabled iptables for docker,
Added "iptables": false in /etc/docker/daemon.json and restarted docker