Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-35025

Container command '/bin/cat' not found or does not exist

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • None
    • docker:1.11
      jenkins:1.651.2
      docker-custom-build-environment:1.6.5

      I'm using Jenkins as a Docker container by installing Docker within my Jenkins container and binding Docker socket (see config below).
      I try to compile a Maven project using maven:3.2-jdk-7 (see attached image).
      But I have this error:

      $ docker run --rm --entrypoint /bin/true alpine:3.2
      $ docker run --tty --rm --entrypoint /sbin/ip alpine:3.2 route
      $ docker run --tty --detach --workdir /var/jenkins_home/jobs/xxxxx/workspace --volume /var/jenkins_home:/var/jenkins_home:rw --volume /tmp:/tmp:rw --net bridge --add-host dockerhost:172.17.0.1 --env BUILD_DISPLAY_NAME=#1 --env BUILD_ID=1 --env BUILD_NUMBER=1 --env BUILD_TAG=xxxxx-1 --env BUILD_URL=http://localhost:8080/job/xxxxx/1/ --env CLASSPATH= --env EXECUTOR_NUMBER=0 --env GIT_BRANCH=origin/master --env GIT_COMMIT=883d20d67b50b0daea5a78d3192a4f84ed282fb4 --env GIT_URL=https://git.xxxxxxxx.git --env HUDSON_HOME=/var/jenkins_home --env HUDSON_SERVER_COOKIE=70042bb5dbdea6c1 --env HUDSON_URL=http://localhost:8080/ --env JENKINS_SERVER_COOKIE=70042bb5dbdea6c1 --env JENKINS_URL=http://localhost:8080/ --env JOB_NAME=xxxxx --env JOB_URL=http://localhost:8080/job/xxxxx/ --env NODE_LABELS=master --env NODE_NAME=master --env WORKSPACE=/var/jenkins_home/jobs/xxxxx/workspace maven:3.2-jdk-7 /bin/cat
      docker: Error response from daemon: Container command '/bin/cat' not found or does not exist..
      FATAL: Failed to run docker image
      java.lang.RuntimeException: Failed to run docker image
      	at com.cloudbees.jenkins.plugins.docker_build_env.Docker.runDetached(Docker.java:226)
      	at com.cloudbees.jenkins.plugins.docker_build_env.DockerBuildWrapper.startBuildContainer(DockerBuildWrapper.java:202)
      	at com.cloudbees.jenkins.plugins.docker_build_env.DockerBuildWrapper.setUp(DockerBuildWrapper.java:175)
      	at hudson.model.Build$BuildExecution.doRun(Build.java:156)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
      	at hudson.model.Run.execute(Run.java:1738)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:410)
      Finished: FAILURE
      

      I don't understand why I have this error as I'm able to compile my project locally using this Maven Docker image.

      Here is my config:

      Dockerfile

      FROM jenkins:1.651.2
      
      USER root
      
      RUN \
        apt-get update && \
        apt-get install -y apt-transport-https ca-certificates && \
        echo "deb https://apt.dockerproject.org/repo debian-jessie main" > /etc/apt/sources.list.d/docker.list && \
        apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D && \
        apt-get update && \
        apt-get install -y \
          lxc \
          sudo \
          docker-engine \
          bzip2 && \
        usermod -a -G docker jenkins
      
      RUN chown -R jenkins "$JENKINS_HOME" /usr/share/jenkins/ref
      
      USER jenkins
      

      docker-compose.yml

      jenkins:
        build: .
        ports:
          - "8080:8080"
          - "5000:5000"
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock
      

        1. jenkins.png
          59 kB
          Cedric Thiebault

            Unassigned Unassigned
            cthiebault Cedric Thiebault
            Votes:
            3 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: