distribution / distribution-library-image

285 stars 178 forks source link

can't use localhost to access service in swarm #51

Open fsp357838 opened 7 years ago

fsp357838 commented 7 years ago

From many documents,I know we can access the service on any node in the swarm by using localhost:$PORT. for example,I start a service by the command "docker service create --name registry --publish 5000:5000 registry:2". According to what is said--https://guai.im/2016/08/08/docker-swram-in-aciton-03/, we can get result by command "curl localhost:5000/v2/_catalog",but I failed,sometimes,I can get result by the command "curl 127.0.0.1:5000/v2/_catalog",but not all nodes.

magol commented 6 years ago

Have you found any solution for this?

czi commented 4 years ago

I just ran into this with docker version 19.03.11 on SLES 12 SP5. My systems defined localhost as both 127.0.0.1 and ::1 in /etc/hosts by default. I commented out the ::1 entry and left the 127.0.0.1 entry. Everything started working as expected.