Hey all any help is very much appreciated, I have been stuck on this for a week now...
I am trying to put my golang backend api built by the framework goa inside of a docker container. When I build and run the go binary the server works as intended, I am able to go to my routes and see data being returned. As soon as I put the server in a docker container I get the ERR_CONNECTION_REFUSED / ERR_SOCKET_NOT_CONNECTED and I am very confused on what I am doing wrong.
Here is my Docker file
# Grab hardened go image from artifactory.
FROM golang:1.16.9-alpine
# Set working directory to be inside the container.
WORKDIR /app
COPY . .
# Download all dependencies.
RUN go build -o main ./cmd
#Expose the port
EXPOSE 8080
# Run the executable
CMD ["./main"]
Here is my netstat result
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN -
tcp6 0 0 :::8080 :::* LISTEN -
And lastly, this is when I run the container
[api] 21:43:17 HTTP "Auth" mounted on GET /api/auth
[api] 21:43:17 HTTP "Create" mounted on POST /api/user
[api] 21:43:17 HTTP "ReadByID" mounted on GET /api/user/{id}
[api] 21:43:17 HTTP server listening on "localhost:8080"
Any help is appreciated, let me know if I can provide any more details