Search code examples
dockerdocker-container

how to run command in docker using a script outside thecontainer


in my .mk file I have done as following

.PHONY : Test
Test:
  @echo Starting Docker container
  docker container start XXX;
  docker exec -it -w /home/TA/G/T/P XXX bash
  docker exec /home/CO/CO_ANAlysis/bin/c-build --dir results--encoding UTF-8 make

and then I want to execute that it execute the first two and when docker container starts the command "docker exec /home/CO/CO_ANAlysis/bin/c-build --dir results--encoding UTF-8 make" doesn't execute

and if I run this out of docker:

docker exec -it -w /home/TA/G/T/P SDIO bash /home/CO/CO_ANAlysis/bin/c-build --dir results--encoding UTF-8 make

it shows me :

/home/CO/CO_ANAlysis/bin/c-build: /home/CO/CO_ANAlysis/bin/c-build: cannot execute binary filehow can I, in a mk file, run commands inside a docker?

Thanks


Solution

  • Problem Solved

      docker container start XXX;
      docker exec -it -w /home/TA/G/T/P XXX /home/CO/CO_ANAlysis/bin/c-build --dir results--encoding UTF-8 make