I have an application running inside docker on the port 8585. I can access the application internally by going to the terminal of the container through docker desktop and doing curl to the localhost:8585 to it and I can see HTML content being returned by the application. However, when I try to hit the URL outside of docker (http://localhost:8585) i.e. on the browser running on Mac then I get “ERR_EMPTY_RESPONSE” error on the same port i.e. 8585.
Below is the command I used to run the docker image
docker run -d -p 8585:8585 ftl-server --name ftls1@localhost:8585
Below are the set of commands that I ran to prove the application is working fine internally on the docker container but not from outside.
Sunnys-MacBook-Pro:FTL - Sunny$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 405cb36f8868 ftl-server "/opt/run.sh -…" 4 minutes ago Up 4 minutes 0.0.0.0:8585->8585/tcp great_pasteur Sunnys-MacBook-Pro:FTL - Sunny$ docker exec -it 405cb36f8868 bash bash-4.4$ pwd /opt bash-4.4$ curl http://localhost:8585 <!DOCTYPE html> <html data-ng-app="ftl"> <head lang="en"> <base href="/"> <meta charset="UTF-8"> <title translate="APPLICATION_TITLE"></title>
I had tried running a sample “node js” app and don’t get this issue i.e. I am able to access “node js” app both inside and on the mac browser but wondering why this would be the case for this specific application that I am trying to run. If I am able to do curl locally then ideally it should be accessible from outside of the docker container. Can share more details on the docker inspect if needed but wondering if someone else come across similar challenge in the past?