Question: I am building a golang WebService in docker. The build seems fine but I am unable to expose the port for external (outside of container) access. When I curl from the command line (inside the container) the app appears to work fine. 

I saw quite a few posts of similar problems but unfortunately many were not resolved or didn't seem applicable.

```
FROM golang:alpine
RUN mkdir /go/src/webservice_refArch
ADD . /go/src/webservice_refArch
WORKDIR /go/src/webservice_refArch
RUN apk add curl
RUN cd /go/src/webservice_refArch/ && go get ./...
RUN cd /go/src/webservice_refArch/cmd/reference-w-s-server && go build -o ../../server
EXPOSE 7878
ENTRYPOINT ["./server", "--port=7878"]

```

I have tried both: 

* :7878
* localhost:7878

Answer: 
I was facing the same issue. Then what I did is change the ListernHost from localhost to 0.0.0.0 and it worked.

To debug this tried curl inside the container it was working fine but outside the container the response of the curl was blank. The port mapped but the content was not served outside the container. Once you change the "localhost" to 0.0.0.0 it will work.
if you are trying to access the port inside your docker container from your local machine, you need map it to the desired port on your local machine
`docker run -p 7878:7878 IMAGE`
Then you should be able to access it on your host