I am trying to run a golang web server application (which tries to run a go blog powered by same tools which power golang blog) via docker. It runs fine without docker but fails to give any response if I use docker. I have no clue why this is happening as for a much simpler go web application, the same docker based approach works great. See below for output of various commands I used. Any help would be greatly appreciated.
docker pull maddyonline/gotutorial
docker run -d --publish 8080:8080 --name gotut maddyonline/gotutorial
81bc36e385286326a6d9f74322515a7b9748e493275c3426bcc6848a4589a7e7
docker ps
CONTAINER ID IMAGE COMMAND
CREATED STATUS PORTS NAMES 81bc36e38528 maddyonline/gotutorial "go-wrapper run" 20 seconds ago Up 20 seconds 0.0.0.0:8080->8080/tcp gotut
curl localhost:8080
curl: (52) Empty reply from server
docker exec gotut curl localhost:8080
<!DOCTYPE html> <html> <head>
And rest of the file
The docker file I am using is very simple.
FROM golang:onbuild
EXPOSE 8080
I experimented with the same docker file with a much simpler golang application on the same server. And it works.
docker pull maddyonline/gowebapp
docker run -d --publish 8080:8080 --name gowebapp maddyonline/gowebapp
curl localhost:8080/icecream
Hi there, I think I love icecream!