Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

359
Visualizações
Why 0.0.0.0 is working and localhost or 127.0.01 is not

I have a grpc-go server running in docker container, listening on 0.0.0.0:8080. I found this to be working after having failures with listening on localhost or 127.0.0.1 in a docker container - and it only failed running in a docker container, not if I go run on the same machine.

Also a simple web server did work listening on localhost or 127.0.0.1.

I found that 0.0.0.0 is listening on any network adapter - but found no other explanations.

Well, problem solved - but I am looking for an explanation - do you know?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Networking is one of the namespaces in docker, similar to the pid and filesystem namespaces. If you kill pid 1 inside a container, that kills the process inside the container and not systemd/init on the host (as long as you don't override the namespace). And if you rm -rf /bin inside a container, that deletes files from that container, not from the host (as long as you don't have a volume mount). Similarly, the loopback network (localhost or 127.0 0.1) in a namespace refers to just that namespace, not the host.

Thinking about it from a higher level, loopback on the host is only reachable from that host, you cannot access it from another host, or an external load balancer. Namespaced networking works very similar. Loopback inside the container can be reached by other processes inside that same network namespace, but not containers in other namespaces, and not from the host with port forwarding since that forwards to the virtual network interface, similar to how an external load balancer forwards to the host network interface.

over 4 years ago · Santiago Trujillo Relatório

0

This may be due to the browser cache!

In my case, I had some errors configuring the .htaccess file which makes 301 redirects. Because I tested with both localhost and 127.0.0.1, they no longer work. When I tested them with curl, I found that it's just a browser cache.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda