Move file from Docker container to Host system in Jenkins

I have configured Jenkins in Docker container. I am able to take a build. After a build I want to move WAR file into my Tomcat server which is running in host system. I have added copy command in post build task. Jenkins is not able to move the WAR to host system , since it is running in container.

How to move WAR file from container to Host system ?

  • gulp watch seems to freeze in Docker
  • Running Tomcat with PostgreSql using Dockerfile
  • Dockerfile ENV backtick interpolation
  • How to startup up services on a Docker image?
  • How to set custom IP for Solr server from Docker compose file?
  • How to get container id of running container programmatically (on Docker)?
  • Host path : /home/test/tomcat/webapps

    Jenkins container path: /var/jenkins/workspace/dev/welcome/target/welcome.war

  • Push docker image to remote server
  • Docker Container to Host Routing
  • How do I “dockerize” a redis service using phusion/baseimage-docker
  • Load balancing docker swarm using Ha Proxy
  • Fixing exited docker container
  • Access container environment variables in inline run command
  • One Solution collect form web for “Move file from Docker container to Host system in Jenkins”

    I would create a volumne when starting jenkins with docker and then copy the war file there with a normal shell jenkins command. I usually do
    docker run -d -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 -p 50000:50000 -v /home/docker:/var/jenkins_home --net="host" --env JAVA_OPS="-Xms1024m -Xmx1024m" --privileged=true axltxl/jenkins-dood

    The -v option is to create a volumne, which is a shared folder for container and host. In my case I use that for having the jenkins configuration outside docker container.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.