docker: command not found with Jenkins build and publish plugin on Mac

I am new to using Jenkins and docker plugins. I have jenkins installed on my Mac Os. I am trying to build a project on jenkins using docker build and publish plugin as a build step.

It fails with below error

  • Pulling docker image python:2.7-onbuild taking a long time
  • Build a docker image from vagrant
  • build docker image with dockerfile by jenkins
  • I started a docker container with --rm Is there an easy way to keep it, without redoing everything?
  • I can't set up Kubernetes in Centos 7: Unable to update cni config
  • How to hide Docker containers behind a single hostname
  • java.io.IOException: Cannot run program "docker" (in directory "***"): error=2, No such file or directory
    

    Looks like docker is not available to jenkins user but available to root and other user on my Mac.

    sudo su jenkins
    bash-3.2$ docker ps
    bash: docker: command not found
    
    sudo su XXX
    bash-3.2$ docker ps
    CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
    bash-3.2$ 
    

    Is this some permissions issue? Can you please help?

    Thanks

  • How to save application state in Marathon?
  • Bower + Git submodules + Docker compose
  • connection issues between apacheds and tomcat docker containers
  • Configuring docker to communicate over the network
  • Cant build a docker dart-runtime image after a local pub-get
  • How can I create predictive mappings between network interface names and bridged networks in docker
  • One Solution collect form web for “docker: command not found with Jenkins build and publish plugin on Mac”

    Inspect the permissions of the docker binary:

    stat $(where docker)
    

    Check the owner and group,
    in osx stuff is usually in staff group, try adding your jenkins user to that group:

    sudo dseditgroup -o edit -a jenkins -t user staff
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.