Boa tarde a todos. Comecei recentemente a estudar docker e estou com o seguinte problema:

A conexão foi reiniciada. A conexão com o servidor foi reiniciada durante o carregamento da página.

Como está meu projeto:

Uma API de servidor rodando o eureka-server e somente isso, nada de endpoints.
Uma API de eureka-client rodando meus endpoints.

Ao subir pela IDE Spring Tools Suite, tudo funciona normalmente. Mas quando rodo primeiramente o servidor na porta 8585 via docker, não da certo. (No STS a porta para o server está configurada como 8761, mas creio que ao subir pelo Docker seja utilizada a porta informada pro Docker que é 8585, certo?)

Ao dar os comandos:

Para Build da imagem: docker build -t docker-eureka-server/api-eureka-server . Para Run do container: docker run -p 8585:8585 docker-eureka-server/api-eureka-server

A aplicação sobe normalmente sem erros, mas ao tentar acessar pelo navegador aparece o seguinte erro:

A conexão foi reiniciada. A conexão com o servidor foi reiniciada durante o carregamento da página. Este site pode estar temporariamente indisponível ou sobrecarregado. Tente novamente daqui a pouco. Se você não conseguir carregar nenhuma página, verifique a conexão de rede do computador. Se a rede ou o computador estiver protegido por um firewall ou proxy, verifique se o Firefox está autorizado a acessar a web. Citação

E ao subir a API com os endpoints, depois de rodar o eureka-server, volta o mesmo erro no navegador.

Segue configuração do Dockerfile:

FROM openjdk:17.0.2-jdk-oracle
EXPOSE 8585:8585
ARG JAR_FILE=target/*.jar
COPY target/eureka-server-0.0.1-SNAPSHOT.jar /app/apieurekaserver.jar
ENTRYPOINT ["java", "-jar", "/app/apieurekaserver.jar"]

Estou sem saber o que fazer. Alguém pode me dar uma luz, por favor? Desde já agradeço!

Comment From: scottfrederick

From Google Translate:

Good afternoon everybody. I recently started studying docker and I have the following problem:

The connection has been restarted. The connection to the server was reset while the page was loading.

How is my project:

A server API running eureka-server and just that, no endpoints.
A eureka-client API running my endpoints.

When uploading the IDE Spring Tools Suite, everything works normally. But when I first run the server on port 8585 via Docker, it doesn't work. (In the STS, the port for the server is configured as 8761, but I believe that when uploading through Docker, the port informed to Docker is used, which is 8585, right?)

When giving commands:

To build the image: docker build -t docker-eureka-server/api-eureka-server . To run the container: docker run -p 8585:8585 docker-eureka-server/api-eureka-server

The application loads normally without errors, but when trying to access it via the browser the following error appears:

The connection has been restarted. The connection to the server was reset while the page was loading. This site may be temporarily unavailable or overloaded. Try again in a little while. If you cannot load any pages, check your computer's network connection. If your network or computer is behind a firewall or proxy, check whether Firefox is authorized to access the web. 

And when uploading the API with the endpoints, after running eureka-server, the same error returns in the browser.

Below is the Dockerfile configuration:

FROM openjdk:17.0.2-jdk-oracle
EXPOSE 8585:8585
ARG JAR_FILE=target/*.jar
COPY target/eureka-server-0.0.1-SNAPSHOT.jar /app/apieurekaserver.jar
ENTRYPOINT ["java", "-jar", "/app/apieurekaserver.jar"]

I don't know what to do. Can anyone give me some light, please? Thank you very much in advance!

Comment From: scottfrederick

Thanks for getting in touch. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements. This feels like a question that would be better suited to Stack Overflow. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.