I'm trying to configure CI with Jenkins for my private project. Problem:

  • whenever I start building a pipeline project, it gives me ,,Docker is not found'' error
  • whenever I try to work around this by installing npm plugin and running bash script npm install as a build step, I get node/npm not found

Solutions I've found and tried:

According to official Jenkins docker image docs, all one is supposed to do is to mount docker.socket in dockerfile/docker-compose file and it should ,,just'' work (it doesn't) - example:

     - /var/run/docker.sock:/var/run/docker.sock

The only solution that was close to working as intended, was to install docker directly on Jenkins container and then setting user for jenkins. It works, but only until docker image is running. When I kill it and run it again, docker isn't installed on container and so every pipeline fails again. I can't have that, I cannot have a downtime caused by say remote server being down. I'd have to manually install docker on that Jenkins container every time something was down.

Any ideas?

  1. There are two ways to run Jenkins builds.
    1. The build node executes the build. In that case, all tools the build needs have to be installed on that node/slave.
    2. The build is run inside a Docker container (with a build node as host). In that case, the Docker image for the build needs to contain all the tools the build needs, but the Jenkins node doesn't have to.
  2. "Kill and run again" as in docker stop $name; docker rm $name; docker run ...? Sure, that deletes all data local to that container.

    • If you want to stop and restart the same container, use docker stop and docker start instead.
    • If you want to carry data over from one container to another, use volumes.
  3. If you want to go with 1.1 and you need all your Jenkins nodes to come equipped with a certain set of tools (such as Docker, npm, ...), create your own Docker image for them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.