please find the attached dockerfile
please suggest

Regards
irfan


On Fri, Oct 23, 2015 at 10:11 AM, Irfan Sayed <[email protected]> wrote:

> Moved further and tried to build the docker image using dockerfile.
> Jenkins job was able to fetch the dockerfile and build the image.
> in the Jenkins job configuration, i have used the docker container as
> build environment.
> in the dockerfile, i am downloading the maven and setting up the path so
> that "mvn" commands can be accessed when we start the container.
> however, mvn command line is not accessible. Here are the crispy Jenkins
>  log:
>
> Docker container 
> 87de3c721ba5c07e84bc006d539ed8849a5dae4ecf06be3bb69fa9746bebc9ec started to 
> host the build
>
>
> PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin 
> PWD=/tmp/workspace/docker SELINUX_LEVEL_REQUESTED= SELINUX_ROLE_REQUESTED= 
> SELINUX_USE_CURRENT_RANGE= SHELL=/bin/bash SHLVL=1 "SSH_CLIENT=192.168.102.19 
> 56356 22" "SSH_CONNECTION=192.168.102.19 56356 192.168.102.28 22" USER=root 
> WORKSPACE=/tmp/workspace/docker XDG_RUNTIME_DIR=/run/user/0 
> XDG_SESSION_ID=602 XFILESEARCHPATH=/usr/dt/app-defaults/%L/Dt mvn clean 
> package*env: mvn: No such file or directory*
> Build step 'Invoke top-level Maven targets' marked build as failure
> Stopping Docker container after build completion
> $ docker kill c9daf81ddb63d099a10ddba419ea78d690061786cb68b5cbe5ceddbc0366dcb1
> c9daf81ddb63d099a10ddba419ea78d690061786cb68b5cbe5ceddbc0366dcb1
> $ docker rm --force 
> c9daf81ddb63d099a10ddba419ea78d690061786cb68b5cbe5ceddbc0366dcb1
> c9daf81ddb63d099a10ddba419ea78d690061786cb68b5cbe5ceddbc0366dcb1
>
>
> I am not getting how the path is not getting setup.
>
> when i tried locally, using docker attach command to work on container, i am 
> able to access mvn command
>
>
> please suggest
>
>
> Regards,
>
> Irfan
>
>
>
>
> On Tue, Oct 20, 2015 at 11:36 AM, Irfan Sayed <[email protected]>
> wrote:
>
>> Thanks Nicolas and Richard for your valuable inputs
>> it's resolved.
>>
>> Regards
>> Irfan
>>
>>
>>
>> On Mon, Oct 19, 2015 at 10:12 AM, Richard Bywater <[email protected]>
>> wrote:
>>
>>> You shouldn't be pointing it at Port 22 as that's the SSH port. You'll
>>> need to check which tcp port you've got your Docker daemon listening on for
>>> Docker API calls.
>>>
>>> Richard.
>>>
>>> On Mon, 19 Oct 2015 5:38 pm Irfan Sayed <[email protected]> wrote:
>>>
>>>> update:
>>>> on the build slave configuration , i have set the following variable:
>>>>
>>>> variable : DOCKER_HOST
>>>> value : tcp://192.168.102.28:22
>>>> does it suffice ?
>>>>
>>>> Do i need to set DOCKER_TLS_VERIFY variable ?
>>>>
>>>> Regards
>>>>
>>>>
>>>>
>>>> On Mon, Oct 19, 2015 at 7:36 AM, Irfan Sayed <[email protected]>
>>>> wrote:
>>>>
>>>>>
>>>>> thanks.
>>>>> when i ssh to slave box (docker host), i can run following comamnd
>>>>>
>>>>> [root@localhost ~]# docker images
>>>>> REPOSITORY          TAG                 IMAGE ID
>>>>> CREATED                  VIRTUAL SIZE
>>>>> centos7try10        latest              482d7f9db0fc        Less than
>>>>> a second ago   999.4 MB
>>>>> <none>              <none>              086ff303fac0        Less than
>>>>> a second ago   453.3 MB
>>>>> centos7try1         latest              5632e539e10f        Less than
>>>>> a second ago   998.9 MB
>>>>> docker.io/centos    centos7             ce20c473cd8a        Less than
>>>>> a second ago   172.3 MB
>>>>> jenkins_slave       latest              a8ec8904386f        7 hours
>>>>> ago              172.8 MB
>>>>> <none>              <none>              2249793a098a        7 hours
>>>>> ago              277.4 MB
>>>>>
>>>>> just want to re-iterate , slave box and docker host are same box and i
>>>>> am just connecting to slave from jenkins master using ssh 22 port
>>>>> and using docker plugin to build image form Dockerfile
>>>>>
>>>>> please suggest
>>>>>
>>>>> Regards
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Oct 19, 2015 at 3:07 AM, nicolas de loof <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Can you run docker commands without setting -H ?
>>>>>> In this case docker will use /var/run/docker.sock unix socket and not
>>>>>> rely on TLS for security, which is the default behavior for access to 
>>>>>> local
>>>>>> daemon.
>>>>>> docker plugins will work the same in such a setup, and you don't have
>>>>>> to set a docker host in your jenkins configuration but just let plugin
>>>>>> access local daemon.
>>>>>>
>>>>>> 2015-10-18 20:30 GMT+02:00 Irfan Sayed <[email protected]>:
>>>>>>
>>>>>>> further update :
>>>>>>>
>>>>>>> here is the docker process and running and it's PID
>>>>>>>
>>>>>>> [root@localhost docker]# ps -ef | grep docker
>>>>>>> root      1623     1  0 12:11 ?        00:00:28 /usr/bin/docker -d
>>>>>>> --selinux-enabled
>>>>>>> root      3480  3415  0 12:54 ?        00:00:00 bash -c cd
>>>>>>> "/tmp/workspace/docker" && java  -jar slave.jar
>>>>>>> root     12299 11158  0 23:00 pts/2    00:00:00 grep --color=auto
>>>>>>> docker
>>>>>>>
>>>>>>> further, if i run following command:
>>>>>>>
>>>>>>> [root@localhost docker]# docker -H=tcp://192.168.102.28:22 images
>>>>>>> Get http://192.168.102.28:22/v1.19/images/json: malformed HTTP
>>>>>>> response "SSH-2.0-OpenSSH_6.4". Are you trying to connect to a 
>>>>>>> TLS-enabled
>>>>>>> daemon without TLS?
>>>>>>>
>>>>>>> regards
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Sun, Oct 18, 2015 at 11:39 PM, Irfan Sayed <[email protected]>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> i have just ssh (using port 22) to connect to docker host which is
>>>>>>>> nothing but slave box
>>>>>>>> this is what i have done.
>>>>>>>>
>>>>>>>> i haven't specified any docker URL. In job configuration, i have
>>>>>>>> just given the path of Dockerfile and trying to build the image from 
>>>>>>>> that
>>>>>>>> Dockerfile
>>>>>>>>
>>>>>>>> please suggest
>>>>>>>>
>>>>>>>> Regards
>>>>>>>>
>>>>>>>>
>>>>>>>> On Sun, Oct 18, 2015 at 11:31 PM, Richard Bywater <
>>>>>>>> [email protected]> wrote:
>>>>>>>>
>>>>>>>>> Have you specified the port 22 from that Docker URL or are the
>>>>>>>>> plug-ins doing that as port 22 isn't  right for Docker.
>>>>>>>>>
>>>>>>>>> Richard
>>>>>>>>>
>>>>>>>>> On Sun, 18 Oct 2015 11:22 pm Irfan Sayed <[email protected]>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> hi all,
>>>>>>>>>>
>>>>>>>>>> I am trying to provision the build containers dynamically using
>>>>>>>>>> docker . i have installed jenkins master along with docker plugins . 
>>>>>>>>>> build
>>>>>>>>>> slave is docker host and all are running on unix setup : centos : 6.5
>>>>>>>>>>
>>>>>>>>>> here is my setup:
>>>>>>>>>>
>>>>>>>>>> Jenkins master : 1.633
>>>>>>>>>> cloudbees docker build and publish plugin : 1.0.1
>>>>>>>>>> cloudbees docker custom build env plugin : 1.6.1
>>>>>>>>>> docker commons plugin : 1.2
>>>>>>>>>> docker build step : 1.31
>>>>>>>>>> kubernetes plugin : 0.4.1
>>>>>>>>>>
>>>>>>>>>> I have deployed the docker host and created Dockerfile. i am able
>>>>>>>>>> to build docker image using Dockerfile on the docker host and run in 
>>>>>>>>>> the
>>>>>>>>>> container
>>>>>>>>>> however, from jenkins master , whenever i am trying to connect to
>>>>>>>>>> docker host and build docker image using docker plugin , i am getting
>>>>>>>>>> following error
>>>>>>>>>>
>>>>>>>>>> Started by user anonymous <http://115.113.226.194:2003/user/null>
>>>>>>>>>> Building remotely on 192.168.102.28 
>>>>>>>>>> <http://115.113.226.194:2003/computer/192.168.102.28> in workspace 
>>>>>>>>>> /tmp/workspace/docker
>>>>>>>>>> $ docker inspect 43728998fde0187a1f0b526fef5e2db9b02796a3
>>>>>>>>>> []
>>>>>>>>>> Build Docker image from /tmp/workspace/docker/Dockerfile ...
>>>>>>>>>> $ docker build --tag 43728998fde0187a1f0b526fef5e2db9b02796a3 --file 
>>>>>>>>>> Dockerfile /tmp/workspace/docker
>>>>>>>>>> Sending build context to Docker daemon 497.2 kB
>>>>>>>>>>
>>>>>>>>>> Sending build context to Docker daemon
>>>>>>>>>> Post 
>>>>>>>>>> http://192.168.102.28:22/v1.19/build?cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&memory=0&memswap=0&rm=1&t=43728998fde0187a1f0b526fef5e2db9b02796a3:
>>>>>>>>>>  malformed HTTP response "SSH-2.0-OpenSSH_6.4". Are you trying to 
>>>>>>>>>> connect to a TLS-enabled daemon without TLS?
>>>>>>>>>> FATAL: Failed to build docker image from project 
>>>>>>>>>> Dockerfilejava.lang.RuntimeException 
>>>>>>>>>> <http://stacktrace.jenkins-ci.org/search?query=java.lang.RuntimeException>:
>>>>>>>>>>  Failed to build docker image from project Dockerfile
>>>>>>>>>>      at 
>>>>>>>>>> com.cloudbees.jenkins.plugins.docker_build_env.Docker.buildImage(Docker.java:121)
>>>>>>>>>>  
>>>>>>>>>> <http://stacktrace.jenkins-ci.org/search/?query=com.cloudbees.jenkins.plugins.docker_build_env.Docker.buildImage&entity=method>
>>>>>>>>>>      at 
>>>>>>>>>> com.cloudbees.jenkins.plugins.docker_build_env.DockerfileImageSelector.prepareDockerImage(DockerfileImageSelector.java:41)
>>>>>>>>>>  
>>>>>>>>>> <http://stacktrace.jenkins-ci.org/search/?query=com.cloudbees.jenkins.plugins.docker_build_env.DockerfileImageSelector.prepareDockerImage&entity=method>
>>>>>>>>>>      at 
>>>>>>>>>> com.cloudbees.jenkins.plugins.docker_build_env.DockerBuildWrapper.setUp(DockerBuildWrapper.java:152)
>>>>>>>>>>  
>>>>>>>>>> <http://stacktrace.jenkins-ci.org/search/?query=com.cloudbees.jenkins.plugins.docker_build_env.DockerBuildWrapper.setUp&entity=method>
>>>>>>>>>>      at hudson.model.Build$BuildExecution.doRun(Build.java:156) 
>>>>>>>>>> <http://stacktrace.jenkins-ci.org/search/?query=hudson.model.Build$BuildExecution.doRun&entity=method>
>>>>>>>>>>      at 
>>>>>>>>>> hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
>>>>>>>>>>  
>>>>>>>>>> <http://stacktrace.jenkins-ci.org/search/?query=hudson.model.AbstractBuild$AbstractBuildExecution.run&entity=method>
>>>>>>>>>>      at hudson.model.Run.execute(Run.java:1741) 
>>>>>>>>>> <http://stacktrace.jenkins-ci.org/search/?query=hudson.model.Run.execute&entity=method>
>>>>>>>>>>      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) 
>>>>>>>>>> <http://stacktrace.jenkins-ci.org/search/?query=hudson.model.FreeStyleBuild.run&entity=method>
>>>>>>>>>>      at 
>>>>>>>>>> hudson.model.ResourceController.execute(ResourceController.java:98) 
>>>>>>>>>> <http://stacktrace.jenkins-ci.org/search/?query=hudson.model.ResourceController.execute&entity=method>
>>>>>>>>>>      at hudson.model.Executor.run(Executor.java:408) 
>>>>>>>>>> <http://stacktrace.jenkins-ci.org/search/?query=hudson.model.Executor.run&entity=method>
>>>>>>>>>> Finished: FAILURE
>>>>>>>>>>
>>>>>>>>>> i am not getting what is the triggering point for :
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> *Are you trying to connect to a TLS-enabled daemon without TLS?*
>>>>>>>>>>
>>>>>>>>>> can someone please suggest
>>>>>>>>>>
>>>>>>>>>> Regards
>>>>>>>>>>
>>>>>>>>>> Irfan
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> You received this message because you are subscribed to the
>>>>>>>>>> Google Groups "Jenkins Users" group.
>>>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>>>> send an email to [email protected].
>>>>>>>>>> To view this discussion on the web visit
>>>>>>>>>> https://groups.google.com/d/msgid/jenkinsci-users/CACGLCJZxveD-sjASD5-oFtE8B%2BXY3xavbz9C0SLur0_dT3xaOQ%40mail.gmail.com
>>>>>>>>>> <https://groups.google.com/d/msgid/jenkinsci-users/CACGLCJZxveD-sjASD5-oFtE8B%2BXY3xavbz9C0SLur0_dT3xaOQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>>>>>> .
>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>>> Groups "Jenkins Users" group.
>>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>>> send an email to [email protected].
>>>>>>>>> To view this discussion on the web visit
>>>>>>>>> https://groups.google.com/d/msgid/jenkinsci-users/CAMui9447zbD3yn9ZEqSOti5%2Bz_yENjn%2BRNTL%2Brv6SXSe85_sbw%40mail.gmail.com
>>>>>>>>> <https://groups.google.com/d/msgid/jenkinsci-users/CAMui9447zbD3yn9ZEqSOti5%2Bz_yENjn%2BRNTL%2Brv6SXSe85_sbw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>>>>> .
>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "Jenkins Users" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to [email protected].
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msgid/jenkinsci-users/CACGLCJaNdy4fnboB%3DiMzGPhTKQTxgiUMJmNgrdtccf3C2CuEmQ%40mail.gmail.com
>>>>>>> <https://groups.google.com/d/msgid/jenkinsci-users/CACGLCJaNdy4fnboB%3DiMzGPhTKQTxgiUMJmNgrdtccf3C2CuEmQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Jenkins Users" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/jenkinsci-users/CANMVJzmTRB%3DoLcoYS0vhoM0LfNH4kyUD8xF3qumC7EwU0P%2BF9w%40mail.gmail.com
>>>>>> <https://groups.google.com/d/msgid/jenkinsci-users/CANMVJzmTRB%3DoLcoYS0vhoM0LfNH4kyUD8xF3qumC7EwU0P%2BF9w%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Jenkins Users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/jenkinsci-users/CACGLCJaXO5%2BxNuwSrbJCNHkAYDTMOOAZ%3D%2Bxzumgda99RNp%3DWyw%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/jenkinsci-users/CACGLCJaXO5%2BxNuwSrbJCNHkAYDTMOOAZ%3D%2Bxzumgda99RNp%3DWyw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Jenkins Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/jenkinsci-users/CAMui945%3DTGnY6S_uPj3RFGjbAYbd5YnnrBxt1XmKV8%3DX3LUf4g%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/jenkinsci-users/CAMui945%3DTGnY6S_uPj3RFGjbAYbd5YnnrBxt1XmKV8%3DX3LUf4g%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CACGLCJYy%3DWd0d%3DrN5w6CXqniTiMTvQjoPsiw6OdU7JLdP9xJuA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
FROM centos:centos7

RUN yum -y install openssh-server epel-release wget openssh-clients && \
    yum -y install pwgen && \
    rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_rsa_key && \
    ssh-keygen -q -N "" -t dsa -f /etc/ssh/ssh_host_dsa_key && \
    ssh-keygen -q -N "" -t rsa -f /etc/ssh/ssh_host_rsa_key && \
    sed -i "s/#UsePrivilegeSeparation.*/UsePrivilegeSeparation no/g" 
/etc/ssh/sshd_config && \
    sed -i "s/UsePAM.*/UsePAM no/g" /etc/ssh/sshd_config

ADD set_root_pw.sh /set_root_pw.sh
ADD run.sh /run.sh
RUN chmod +x /set_root_pw.sh
RUN chmod +x /run.sh

#ADD slave.jar /opt/slave.jar

#RUN yum install -y curl
#RUN curl -L https://www.opscode.com/chef/install.sh | bash

ENV AUTHORIZED_KEYS **None**

EXPOSE 22
CMD ["/run.sh"]

COPY jdk-8u60-linux-x64.tar.gz /opt/jdk-8u60-linux-x64.tar.gz

RUN cd /opt/ && tar -zxvf /opt/jdk-8u60-linux-x64.tar.gz

ENV JAVA_HOME /opt/jdk1.8.0_60
RUN echo "export JAVA_HOME=$JAVA_HOME" >> /etc/profile

ENV PATH $PATH:$JAVA_HOME/bin
RUN echo "export PATH=$PATH" >> /etc/profile

# added maven settings
COPY apache-maven-3.3.3-bin.tar.gz /opt/apache-maven-3.3.3-bin.tar.gz
RUN cd /opt/ && tar -zxvf /opt/apache-maven-3.3.3-bin.tar.gz
# setting up maven home
ENV MAVEN_HOME /opt/apache-maven-3.3.3
#setting up maven bin in the path
ENV PATH $PATH:$MAVEN_HOME/bin

#setting up java and maven for jenkins

#COPY /opt/apache-maven-3.3.3/bin/mvn /usr/local/bin
#COPY /opt/jdk1.8.0_60/bin/java /usr/local/bin

Reply via email to