Docker commands to run in script from Command Line

1.8k views Asked by At

I need help with following commands to put in script at CMD. I have all setup for docker.

1) Runs at CMD:

docker run --net=host --interactive --tty auvsisuas/interop-client

2) Runs at # on CMD screen

./tools/interop_cli.py --url http://10.10.130.2:8000 --username testuser missions

Reference : https://github.com/auvsi-suas/interop/wiki/Getting-Started#create-container--start-shell and https://github.com/auvsi-suas/interop/wiki/Getting-Started#get-missions

If I run individual commands in CMD one after another it works and gives me output. But when I put in script (.bat) file, it only runs 1st command after which # prompt appears on screen but 2nd command does not execute.

What I need:

Script to run Both commands together from CMD

Note: The image is publicly available and can be tried on any docker setup.

What I want:(This is what happens when I type directly in CMD)

My .CMD/BAT file

What happens: - stops at the # prompt

Any help is much appreciated.

1

There are 1 answers

2
MandyShaw On

If you are calling a .bat etc. from another one, don't forget that the default behaviour is to transfer control to the lower level script and never come back - you need to use 'call' if you want control to return to the top level script after execution of the lower level one.