Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run script from host machine on Docker container with exec [closed]

Tags:

docker

I do have docker container running and I do quite complex script to run inside container. The script is located on host machine. I can't modify Dockerfile How can I place script file to docker vm to run it with docker exec?

like image 686
Andriy Kopachevskyy Avatar asked Mar 15 '16 08:03

Andriy Kopachevskyy


1 Answers

you can docker cp your script, and then you run it, with something like docker exec -it container_id script

the doc

https://docs.docker.com/engine/reference/commandline/cp/

You can see some examples at https://hub.docker.com/r/k3ck3c/captvty/

extract

docker exec -it container_id unzip -d ~/Captvty ~/Téléchargements/captvty-2.3.10.zip

answer Yes to All

and

docker exec -it container_id rm ~/Téléchargements/captvty-2.3.10.zip

like image 154
user2915097 Avatar answered Sep 29 '22 09:09

user2915097