title: Docker agent with Go
body: <p>I'm trying to create a Jenkins Docker agent that has Go.
  The following is my Dockerfile.</p>
  
  <p>After I build it, if I try: <code>docker run myimage:0.0.1 go version</code> returns the Go version, however if I try this, it doesn't find Go at all.</p>
  
  <pre><code>docker run --privileged --dns 9.0.128.50 --dns 9.0.130.50 -d -P --name slave myimage:0.0.1
  docker ps ## grab the port number
  ssh -p PORT_NUMBER jenkins@localhost
  </code></pre>
  
  <p>What am I missing in order to make Go available under the Jenkins user?</p>
  
  <pre class="lang-rb prettyprint-override"><code>FROM golang:1.11.5-alpine
  
  RUN apk add --no-cache \
  bash \
  curl \
  wget \
  git \
  openssh \
  tar
  
  COPY ssh/*key /etc/ssh/
  COPY skel/ /home/jenkins
  COPY id_rsa /home/jenkins/.ssh/id_rsa
  COPY id_rsa.pub /home/jenkins/.ssh/id_rsa.pub
  
  RUN addgroup docker \
      &amp;&amp; adduser -s /bin/bash -h /home/jenkins -G docker -D jenkins \
      &amp;&amp; echo "jenkins ALL=(ALL) NOPASSWD: ALL" &gt;&gt; /etc/sudoers \
      &amp;&amp; echo "jenkins:jenkinspass" | chpasswd \
      &amp;&amp; chmod u+s /bin/ping \
      &amp;&amp; chown -R jenkins:docker /home/jenkins \
      &amp;&amp; mv /etc/profile.d/color_prompt /etc/profile.d/color_prompt.sh \
      &amp;&amp; mv /bin/sh /bin/sh.bak \
      &amp;&amp; ln -s /bin/bash /bin/sh
  
  # Standard SSH port
  EXPOSE 22
  
  CMD ["/usr/sbin/sshd", "-D"]
  </code></pre>