1

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'
  • If you need to get code to run, that should probably be in your Dockerfile. If you need to run multiple processes, you'd typically do that in multiple separate containers. Can you provide a more complete [mre]? – David Maze Apr 16 '21 at 16:03

1 Answers1

3

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'
kthompso
  • 1,823
  • 6
  • 15