title: docker: not found when using docker command using Docker Jenkins container
body: <p>jenkins is running in a Docker container.</p>
  
  <p>Docker is using in a Mac OS. So I marked out these lines in jenkins.yml:</p>
  
  <pre><code>    # mount docker sock and binary for docker in docker (only works on linux)
      #- /var/run/docker.sock:/var/run/docker.sock
      #- /usr/bin/docker:/usr/bin/docker
  </code></pre>
  
  <p>in Jenkinsfile which is generated by JHipster and includes two tasks int he pipeline:</p>
  
  <ol>
  <li>Perform the build in a Docker container</li>
  <li>Analyze code with Sonar</li>
  </ol>
  
  <p>List item</p>
  
  <pre><code>node {
  stage('checkout') {
      checkout scm
  }
  
  docker.image('openjdk:8').inside('-u root -e MAVEN_OPTS="-Duser.home=./"') {
      stage('check java') {
          sh "java -version"
      }
  </code></pre>
  
  <p>checkout from bitbucket was successful. the pipeline stopped and got an error at docker "pull openjdk:8". Console Output is:</p>
  
  <pre><code>[AAAAApp] Running shell script
  + docker inspect -f . openjdk:8
  /var/jenkins_home/workspace/GeneticsDB@tmp/durable-21459aca/script.sh: 
  2: /var/jenkins_home/workspace/GeneticsDB@tmp/durable-21459aca/script.sh: docker: not found
  [Pipeline] sh
  [AAAAApp] Running shell script
  + docker pull openjdk:8
  /var/jenkins_home/workspace/GeneticsDB@tmp/durable-d5590370/script.sh: 
  2: /var/jenkins_home/workspace/GeneticsDB@tmp/durable-d5590370/script.sh: docker: not found
  </code></pre>
  
  <p>but this command could be run successfully in the command line, like below:</p>
  
  <pre><code>docker pull openjdk:8
      8: Pulling from library/openjdk
      Digest: sha256:18c9622a8dc67b608a2dd0178b4c5aebc0e2da9a656072c6e799cfc46cb96422
      Status: Image is up to date for openjdk:8
  </code></pre>
  
  <p>I know there is a similar question: <a href="https://stackoverflow.com/questions/44850565/docker-not-found-when-building-docker-image-using-docker-jenkins-container-pipel">Docker not found when building docker image using Docker Jenkins container pipeline</a></p>
  
  <p>But my docker is running in Mac OS.</p>