title: Golang cannot find package in Docker image
body: <p>So, I am trying to dockerize a golang application with different directories containing supplementary code for my main file. 
  I am using <strong>gorilla/mux</strong>. The directory structure looks like this. </p>
  
  <pre><code>$GOPATH/src/github.com/user/server
    |--- Dockerfile 
    |--- main.go 
    |--- routes/ 
           handlers.go 
    |--- public/ 
           index.gohtml 
  </code></pre>
  
  <p>It works on my host machine with no problem. The problem is that when I try to deploy the docker image it does not run and exits shortly after creation. I have tried changing the <strong>WORKDIR</strong> command in my dockerfile to <strong>/go/src</strong> and dump all my files there, but still no luck. I have also tried the official documentation on <a href="https://hub.docker.com/_/golang" rel="nofollow noreferrer">docker hub</a>. Doesn't work either.</p>
  
  <p>My Dockerfile.</p>
  
  <pre><code>FROM golang:latest  
  WORKDIR /go/src/github.com/user/server
  COPY . .
  RUN go get -d github.com/gorilla/mux
  
  EXPOSE 8000
  CMD ["go","run","main.go"]
  </code></pre>
  
  <p>My golang <strong>main.go</strong> </p>
  
  <pre class="lang-golang prettyprint-override"><code>package main 
  
  import (
      "github.com/gorilla/mux"
      "github.com/user/server/routes"
      "log"
      "net/http"
      "time"
  )
  func main(){
    //... 
  }
  </code></pre>
  
  <p>I get this error message when I check the logs of my docker image. </p>
  
  <p><strong>Error Message</strong> </p>
  
  <pre><code>main.go:5:2: cannot find package "github.com/user/server/routes" in any of:
      /usr/local/go/src/github.com/user/server/routes (from $GOROOT)
      /go/src/github.com/user/server/routes (from $GOPATH)
  </code></pre>