Run script inside a Docker container from the windows 10 host in cmd or powershell

Viewed 1021

I need to use a program written by someone else within a Docker container (Docker Desktop v19.03.12 in windows 10). I made a script file (bt.sh) to run the third party program with the correct options. It sits in the container, in the folder /root/FrMG_Files/, together with the data files to be processed. I can run the script without problems from within the container (./bt.sh) from the folder /root/FrMG_Files.

I want to automate the process by running the script from the windows host as part of a larger sequence. In windows cmd or powershell, I can get the file list with :

docker exec -it -w /root/FrMG_Files container_id dir

I tried to run the script with many variations such as

docker exec -it -w /root/FrMG_Files container_id ./bt.sh
docker exec -it -w /root/FrMG_Files container_id './bt.sh --cmd “command” host''
docker exec -it -w /root/FrMG_Files container_id "./bt.sh"

but none of these worked. I get the error message: OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec format error": unknown

The script runs with

docker exec -it -w /root/FrMG_Files container_id bash ./bt.sh

The first line of the script is echo "I am in the container" and this works. The other commands do not work (command not found).

I would greatly appreciate some help on this.

Many Thanks!

0 Answers
Related