I am working on golang project, recently I read about docker and try to use docker with my app. I am using mongoDB for database.
Now problem is that, I am creating Dockerfile to install all packages and compile and run the go project.
I am running mongo data as locally, if I am running go program without docker it gives me output, but if I am using docker for same project (just installing dependencies with this and running project), it compile successfully but not gives any output, having error::
CreateSession: no reachable servers
# Start from a Debian image with the latest version of Go installed
# and a workspace (GOPATH) configured at /go.
# Copy the local package files to the container's workspace.
ADD . /go/src/myapp
RUN go get ./...
# Build the installation command inside the container.
RUN go install myapp
# Run the outyet command by default when the container starts.
# Document that the service listens on port 8080.
See Question&Answers more detail:os