user15281199
user15281199

Reputation:

How i can run sh script inside docker-compose file in background?

I have multiple scripts trying to run inside a docker-compose file, these scripts are initiating services that will produce ongoing logs, is there any way that I can run these commands explicitly in the background so docker-compose can execute all commands instead of stucking with the first one

command:
  sh -c './root/clone_repo.sh &&
         appium -p 4723 &&
        ./root/start_emu.sh'

Upvotes: 1

Views: 3344

Answers (1)

kthompso
kthompso

Reputation: 2422

You can run a command in a background process using a single ampersand & after the command. See this comment discussing how to run multiple commands in the background using subshells.

You can use something like this to run the first two commands in the background and continue onto the final command.

command:
  sh -c '(./root/clone_repo.sh &) &&
         (appium -p 4723 &) &&
         ./root/start_emu.sh'

Upvotes: 4

Related Questions