Reputation: 433
How to copy a file from git to remote docker container in jenkins? i know how to copy to local docker container where jenkins is installed (on the same server).
I wrote my Git repo in SourceCodeManagement. I want to execute cmd over ssh. My parameters in jenkins below.
How to write 2nd command to copy a file? Jenkins gives me error there is no /remote/index.html
Upvotes: 0
Views: 1369
Reputation: 1457
seems like your are not going forward in good approach. First ensure your docker container running or run it manually not in exec command.
not in ssh publisher in jenkins
docker run --name nginx -d -p 80:80 nginx
then you can run any command like
docker exec -ti my_container sh -c "echo a && echo b"
docker exec -it <container_id_or_name> sh -c " git clone url"
You should copy any file in docker container rather than you should mount host volume with container volume by this way.
docker run \
--rm \
-u root \
-p 8080:8080 \
-v jenkins-data:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "$HOME":/home \
jenkinsci/blueocean
Upvotes: 1