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 ?

  • ffmpeg failed - 455 Method Not Valid in This State
  • ADD command not working Docker
  • Docker Ubuntu instance not connecting to the network
  • Docker as a builder, can't install systemd header files
  • Docker: Best practice for development and production environment
  • How to get contents generated by a docker container on the local fileystem (minimal failing example)
  • Host path : /home/test/tomcat/webapps

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

  • Enable EXIF support when running Wordpress Docker container
  • Docker - start container with environments variables
  • Running nodejs serialport in a docker container
  • Image deployment with config files
  • Passing envs into gradle build?
  • What I need to use tensorflow on Docker without official tensorflow image?
  • 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.