Containerzised API socket hangs up

  containers, docker, go, postman, rest

I just finished working on a Go REST API and I would like to move my code into a container. I already accomplished this, but I am unable to hit my endpoints through postman since the error: Error: socket hang up is thrown.

According to this SO thread, this could be caused by my firewall, after running ufw status I noticed my firewall is not up, so I am unsure what could be causing this error.

My app seem to be running correctly and I mapped the container with port 8080 in my local machine.

└─(19:14:04 on master ✭)──> docker ps                                                                                                                     ──(Tue,Feb02)─┘
CONTAINER ID   IMAGE        COMMAND       CREATED          STATUS          PORTS                    NAMES
b001f19e2957   go-library   "./library"   15 minutes ago   Up 15 minutes   0.0.0.0:8080->8080/tcp   cranky_kare

I also made sure my request are using this port.

GET http://localhost:8080/books/3
Error: socket hang up
Request Headers
User-Agent: PostmanRuntime/7.26.10
Accept: */*
Postman-Token: 190a5849-b859-4324-a65e-37a7b69b49fb
Host: localhost:8080
Accept-Encoding: gzip, deflate, br

Source: Docker Questions

LEAVE A COMMENT