title: getting "cannot find package" trying to build my application in a docker container
body: <p>Here is my Dockerfile.</p>
  
  <pre><code>FROM ubuntu
  MAINTAINER me &lt;my@email.com&gt;
  RUN apt-get update &amp;&amp; apt-get install -y \
  build-essential \
  curl \
  git \
  make
  # Get and compile go
  RUN curl -s https://go.googlecode.com/files/go1.2.1.src.tar.gz | tar -v -C /usr/local -xz
  RUN cd /usr/local/go/src &amp;&amp; ./make.bash --no-clean 2&gt;&amp;1
  ENV PATH /usr/local/go/bin:/go/bin:$PATH
  ENV GOPATH /go
  RUN go get github.com/gorilla/feeds
  WORKDIR /go 
  CMD go version &amp;&amp; go install feed &amp;&amp; feed
  </code></pre>
  
  <p>It builds just fine:</p>
  
  <pre><code>sudo docker build -t ubuntu-go .
  </code></pre>
  
  <p>but when I run it I get a package error:</p>
  
  <pre><code>sudo docker run -v /home/rbucker/go:/go --name go ubuntu-go
  </code></pre>
  
  <p>The error looks like:</p>
  
  <blockquote>
    <p>src/feed/feed.go:7:2: cannot find package "github.com/gorilla/feeds" in any of:
        /usr/local/go/src/pkg/github.com/gorilla/feeds (from $GOROOT)
        /go/src/github.com/gorilla/feeds (from $GOPATH)</p>
  </blockquote>
  
  <p>It's odd because "go install" is not installing the dependencies and while the previous "go get github.com/gorilla/feeds" completes without errors. So presumably I have a path or environment problem but all of the examples look just like this one.</p>
  
  <p>PS: my code is located in /go/src/feed (feed.go)</p>
  
  <pre><code>package main
  
  import (
      "net/http"
      "time"
  
      "github.com/gorilla/feeds"
  )
  
  . . .
  </code></pre>
  
  <p>UPDATE:  when I performed the "go get" manually and then launched the "run" it seemed to work. So it appears that the "RUN go get" is storing my file in the ether instead of my host's volume.</p>
  
  <pre><code>sudo docker run -v /home/rbucker/go:/go --name go ubuntu-go /bin/bash
  </code></pre>
  
  <p>then</p>
  
  <pre><code>sudo docker run -v /home/rbucker/go:/go --name go ubuntu-go
  </code></pre>
  
  <p>(the files were located in my ~/go/src/githum.com and ~/go/pkg folders.)</p>
  
  <p>UPDATE: It occurs to me that during the BUILD step the /go volume has not been attached to the docker image. So it's essentially assigned to nil. But then during the run the "get install" should have retrieved it's deps.</p>
  
  <p>FINALLY: this works but is clearly not the preferred method:</p>
  
  <pre><code>CMD go get github.com/gorilla/feeds &amp;&amp; go version &amp;&amp; go install feed &amp;&amp; feed
  </code></pre>
  
  <p>notice that I performed the "go get" in the CMD rather than a RUN.</p>