The following is my DockerFile
FROM centos:centos6
MAINTAINER Priyanka
################## Helpful utils
RUN yum -y install sudo
RUN yum -y install curl
RUN yum -y install unzip
################## JDK7
#Note that ADD uncompresses this tarball automatically
ADD jdk-7u79-linux-x64.tar.gz /opt
WORKDIR /opt/jdk1.7.0_79
RUN alternatives --install /usr/bin/java java /opt/jdk1.7.0_79/bin/java 1
RUN alternatives --install /usr/bin/jar jar /opt/jdk1.7.0_79/bin/jar 1
RUN alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_79/bin/javac 1
RUN echo "JAVA_HOME=/opt/jdk1.7.0_79" >> /etc/environment
ENV JAVA_OPTS -Xms1024m -Xmx4196m -XX:NewSize=256m -XX:MaxNewSize=356m -XX:PermSize=256m -XX:MaxPermSize=356m
################## TOMCAT
#Note that ADD uncompresses this tarball automatically
ADD apache-tomcat-7.0.67.tar.gz /usr/share
WORKDIR /usr/share/
RUN mv apache-tomcat-7.0.67 tomcat7
RUN echo "JAVA_HOME=/opt/jdk1.7.0_79/" >> /etc/default/tomcat7
RUN groupadd tomcat
RUN useradd -s /bin/bash -g tomcat tomcat
RUN chown -Rf tomcat.tomcat /usr/share/tomcat7
EXPOSE 8087
################## ROC Client War Download
RUN curl -O http://10.113.57.164:8080/job/ROC4.0_Client/ws/spark-web/entrypoint/target/entrypoint.war
RUN unzip entrypoint.war -d /usr/share/tomcat7/webapps/roc_client
ADD validation-api-1.1.0.Final.jar /usr/share/tomcat7/webapps/roc_client/WEB-INF/lib/
ADD validation-api-1.1.0.Final-sources.jar /usr/share/tomcat7/webapps/roc_client/WEB-INF/lib/
RUN rm /usr/share/tomcat7/webapps/roc_client/WEB-INF/lib/validation-api-1.0.0.GA-sources.jar
RUN rm /usr/share/tomcat7/webapps/roc_client/WEB-INF/lib/validation-api-1.0.0.GA.jar
################## Tomcat launch
CMD ["/usr/share/tomcat7/bin/catalina.sh","run"]
On building this file using docker-build-step in Jenkins the build fails with the following exception at ADD
Step 0 : FROM centos:centos6
---> 3bbbf0aca359
Step 1 : MAINTAINER Priyanka
---> Using cache
---> c8055ba8439a
Step 2 : RUN yum -y install sudo
---> Using cache
---> 203da82ad2af
Step 3 : RUN yum -y install curl
---> Using cache
---> c6cb08257236
Step 4 : RUN yum -y install unzip
---> Using cache
---> 688620db641a
Step 5 : ADD jdk-7u79-linux-x64.tar.gz /opt
ERROR: Build step failed with exception
java.lang.RuntimeException: java.lang.ClassCastException: org.glassfish.json.JsonObjectBuilderImpl$JsonObjectImpl cannot be cast to javax.json.JsonString
at org.jenkinsci.plugins.dockerbuildstep.cmd.CreateImageCommand.execute(CreateImageCommand.java:139)
at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder.perform(DockerBuilder.java:75)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
at hudson.model.Build$BuildExecution.build(Build.java:205)
at hudson.model.Build$BuildExecution.doRun(Build.java:162)
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)
Caused by: java.lang.ClassCastException: org.glassfish.json.JsonObjectBuilderImpl$JsonObjectImpl cannot be cast to javax.json.JsonString
at org.glassfish.json.JsonObjectBuilderImpl$JsonObjectImpl.getJsonString(JsonObjectBuilderImpl.java:194)
at org.glassfish.json.JsonObjectBuilderImpl$JsonObjectImpl.getString(JsonObjectBuilderImpl.java:199)
at org.jenkinsci.plugins.dockerbuildstep.cmd.CreateImageCommand$1.callback(CreateImageCommand.java:123)
at org.jenkinsci.plugins.dockerbuildstep.cmd.CreateImageCommand.readJsonStream(CreateImageCommand.java:161)
at org.jenkinsci.plugins.dockerbuildstep.cmd.CreateImageCommand.execute(CreateImageCommand.java:115)
... 10 more
Build step 'Execute Docker command' marked build as failure
Finished: FAILURE
I have run this build many times and it ran successfully without any problem.I made some temporary changes to build configuration and reverted back. Since then it is throwing this error. Tried removing off all the docker commands from the File and retained just one RUN command.Still the same issue.It is not able to run any docker commands.
I ran into the same issue. Actually the file you are looking for does not exists into your workspace job directory. If your docker-step-plugin could find the file, the command ADD from yout Dockerfile will work :-) Hope this help.
I know this is fairly old, however I ran into this issue and found a different solution which may help others who find this question in the future.
In my case, I'm using devicemapper as the storage driver, and the Logical Volume containing the thinpool had hit 90% full, at which point it triggers an alarm when trying to create a new image. This was causing the Jenkins Docker Plugin to fail with the same stack trace posted above.
Removing old images from the image store fixed the problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.