title: Jenkins - docker: not found
body: <p>I'm pretty new to do docker and jenkins but wanted to see if I could get a node app automatically deployed and running on my raspberry pi. In an ideal world, I'd like to have Jenkins pull down code from github, use a jenkinsfile and dockerfile to build and run the docker image (hopefully this is possible).</p>
  
  <p><strong>jenkinsfile</strong></p>
  
  <pre><code>pipeline {
      agent {
          dockerfile true
      }
      environment {
          CI = 'true' 
          HOME = '.'
      }
      stages {
          stage('Install dependencies') {
              steps {
                  sh 'npm install'
              }
          }
          stage('Test') { 
              steps {
                  sh './scripts/test' 
              }
          }
          stage('Build Container') { 
              steps {
                  sh 'docker build -t test-app:${BUILD_NUMBER} . ' 
              }
          }
      }
  }
  </code></pre>
  
  <p><strong>dockerfile</strong></p>
  
  <pre><code> # Create image based on the official Node image
  FROM node:12
  
  # Create a directory where our app will be placed
  RUN mkdir -p /usr/src/app
  
  # Change directory so that our commands run inside this new directory
  WORKDIR /usr/src/app
  
  # Copy dependency definitions
  COPY package.json /usr/src/app
  
  # Install dependecies
  RUN npm install
  
  # Get all the code needed to run the app
  COPY . /usr/src/app
  
  # Expose the port the app runs in
  EXPOSE 3000
  
  # Serve the app
  CMD ["npm", "start"]
  </code></pre>
  
  <p>However, when I try to run this in jenkins, I get the following error: <em>../script.sh: docker: not found</em>. This seems to be the case for any docker command. I actually tried running some other command starting with 'sudo' and it complained that <em>sudo: not found</em>. Is there a step missing or am I trying to do something in an incorrect way. (NOTE: docker is installed on the raspberry pi. I can log in with the jenkins user and execute docker commands. It just doesn't work through the web ui) Any advice would be appreciated.</p>
  
  <p>Thanks!</p>